setting.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # -*- coding: utf-8 -*-
  2. """
  3. -------------------------------------------------
  4. File Name: setting.py
  5. Description : 配置文件
  6. Author : JHao
  7. date: 2019/2/15
  8. -------------------------------------------------
  9. Change Activity:
  10. 2019/2/15:
  11. -------------------------------------------------
  12. """
  13. BANNER = r"""
  14. ****************************************************************
  15. *** ______ ********************* ______ *********** _ ********
  16. *** | ___ \_ ******************** | ___ \ ********* | | ********
  17. *** | |_/ / \__ __ __ _ __ _ | |_/ /___ * ___ | | ********
  18. *** | __/| _// _ \ \ \/ /| | | || __// _ \ / _ \ | | ********
  19. *** | | | | | (_) | > < \ |_| || | | (_) | (_) || |___ ****
  20. *** \_| |_| \___/ /_/\_\ \__ |\_| \___/ \___/ \_____/ ****
  21. **** __ / / *****
  22. ************************* /___ / *******************************
  23. ************************* ********************************
  24. ****************************************************************
  25. """
  26. SHOW_CONFIG = True # print key config
  27. # import sys
  28. # from os import getenv
  29. # from logging import getLogger
  30. #
  31. # log = getLogger(__name__)
  32. #
  33. # BANNER = """
  34. # ****************************************************************
  35. # *** ______ ********************* ______ *********** _ ********
  36. # *** | ___ \_ ******************** | ___ \ ********* | | ********
  37. # *** | |_/ / \__ __ __ _ __ _ | |_/ /___ * ___ | | ********
  38. # *** | __/| _// _ \ \ \/ /| | | || __// _ \ / _ \ | | ********
  39. # *** | | | | | (_) | > < \ |_| || | | (_) | (_) || |___ ****
  40. # *** \_| |_| \___/ /_/\_\ \__ |\_| \___/ \___/ \_____/ ****
  41. # **** __ / / *****
  42. # ************************* /___ / *******************************
  43. # ************************* ********************************
  44. # ****************************************************************
  45. # """
  46. #
  47. # PY3 = sys.version_info >= (3,)
  48. #
  49. # DB_TYPE = getenv('db_type', 'SSDB').upper()
  50. # DB_HOST = getenv('db_host', '10.10.61.65')
  51. # DB_PORT = getenv('db_port', 6379)
  52. # DB_PASSWORD = getenv('db_password', '_@Fintell')
  53. #
  54. # """ 数据库配置 """
  55. # DATABASES = {
  56. # "default": {
  57. # "TYPE": DB_TYPE,
  58. # "HOST": DB_HOST,
  59. # "PORT": DB_PORT,
  60. # "NAME": "proxy",
  61. # "PASSWORD": DB_PASSWORD
  62. # }
  63. # }
  64. #
  65. # # register the proxy getter function
  66. #
  67. # PROXY_GETTER = [
  68. # "freeProxy01",
  69. # # "freeProxy02",
  70. # "freeProxy03",
  71. # "freeProxy04",
  72. # "freeProxy05",
  73. # # "freeProxy06",
  74. # "freeProxy07",
  75. # # "freeProxy08",
  76. # "freeProxy09",
  77. # "freeProxy13",
  78. # "freeProxy14",
  79. # "freeProxy14",
  80. # ]
  81. #
  82. # """ API config http://127.0.0.1:5010 """
  83. # SERVER_API = {
  84. # "HOST": "0.0.0.0", # The ip specified which starting the web API
  85. # "PORT": 5010 # port number to which the server listens to
  86. # }
  87. #
  88. # VERIFY_HOST = getenv('proxy_verify_host', 'http://www.baidu.com')
  89. # class ConfigError(BaseException):
  90. # pass
  91. #
  92. #
  93. # def checkConfig():
  94. # if DB_TYPE not in ["SSDB", "REDIS"]:
  95. # raise ConfigError('db_type Do not support: %s, must SSDB/REDIS .' % DB_TYPE)
  96. #
  97. # if type(DB_PORT) == str and not DB_PORT.isdigit():
  98. # raise ConfigError('if db_port is string, it must be digit, not %s' % DB_PORT)
  99. #
  100. # from proxyGetter import getFreeProxy
  101. # illegal_getter = list(filter(lambda key: not hasattr(getFreeProxy.GetFreeProxy, key), PROXY_GETTER))
  102. # if len(illegal_getter) > 0:
  103. # raise ConfigError("ProxyGetter: %s does not exists" % "/".join(illegal_getter))
  104. #
  105. #
  106. # checkConfig()