Selaa lähdekoodia

add host ip&port config

Ning Kang 9 vuotta sitten
vanhempi
sitoutus
175a7732a4
3 muutettua tiedostoa jossa 14 lisäystä ja 1 poistoa
  1. 4 0
      Config.ini
  2. 1 1
      DB/RedisClient.py
  3. 9 0
      Util/GetConfig.py

+ 4 - 0
Config.ini

@@ -13,3 +13,7 @@ freeProxySecond = 1
 freeProxyThird  = 1
 freeProxyFourth = 1
 freeProxyFifth  = 1
+
+[HOST]
+ip = 0.0.0.0
+port = 5010

+ 1 - 1
DB/RedisClient.py

@@ -25,7 +25,7 @@ class RedisClient(object):
         :return:
         """
         self.name = name
-        self.__conn = redis.Redis(host=host, port=port, db=0)
+        self.__conn = redis.Redis(host=host, port=port, db=0,password='b840fc02d524045429941cc15f59e41cb7be6c52Kn@#9873#$%')
 
     def get(self):
         """

+ 9 - 0
Util/GetConfig.py

@@ -49,6 +49,13 @@ class GetConfig(object):
     def proxy_getter_functions(self):
         return self.config_file.options('ProxyGetter')
 
+    @LazyProperty
+    def host_ip(self):
+        return self.config_file.get('HOST','ip')
+
+    @LazyProperty
+    def host_port(self):
+        return self.config_file.get('HOST', 'port')
 
 if __name__ == '__main__':
     gg = GetConfig()
@@ -57,3 +64,5 @@ if __name__ == '__main__':
     print(gg.db_host)
     print(gg.db_port)
     print(gg.proxy_getter_functions)
+    print(gg.host_ip)
+    print(gg.host_port)