Permalink
Browse files
Allow redis connection without password
- Loading branch information...
Showing
with
4 additions
and
4 deletions.
-
+4
−4
tweetf0rm/redis_helper.py
|
|
@@ -17,18 +17,18 @@ def __init__(self, name, namespace='default', redis_config=None): |
|
|
|
|
|
self.redis_config = redis_config
|
|
|
self.__redis_connection = redis.StrictRedis(host=redis_config['host'], port=redis_config['port'], db=redis_config['db'])
|
|
|
- self.password = redis_config['password']
|
|
|
+ self.password = redis_config.get('password', None)
|
|
|
self.namespace = namespace
|
|
|
self.name = name
|
|
|
self.key = '%s:%s'%(self.namespace, self.name)
|
|
|
- if (self.password):
|
|
|
- self.__auth()
|
|
|
+ self.__auth()
|
|
|
|
|
|
def get_key(self):
|
|
|
return self.key
|
|
|
|
|
|
def __auth(self):
|
|
|
- self.__redis_connection.execute_command("AUTH", self.password)
|
|
|
+ if self.password:
|
|
|
+ self.__redis_connection.execute_command("AUTH", self.password)
|
|
|
|
|
|
def conn(self):
|
|
|
self.__auth()
|
|
|
|
0 comments on commit
d9e5b1d