If your password for Redis AUTH has # or : in it, it will need to be url encoded. however, redis-py will not automatically decode the url with the current version.
Redis URLs with passwords are in the form of redis(s)://user:pass@server:port/db
If say you had redis://:my#Pass@127.0.0.1:6379/1 this forms an invalid URL
The solution would be to do something like redis://:my%35Pass@127.0.0.1:6379/1
redis-py supports this, however, versions 3.5.3 and below, from_url must be passed decode_components=True ... it defaults to False for now.
It looks like version 4.x will get rid of this and always decode the url, so we could end up with some compatibility issues if we try and pass it.
I was going to put forth a PR, but SyncDict was passing arguments in unnamed so could cause some issues there down the road. from_url probably won't change as far as URL being the first param.
The workaround is to construct your own StrictRedis ( really just Redis now ) and pass it. Already doing that do deal with SSL when the cert can't be verified, but an issue.
Looks a little something like this...I'm using pyramid and pyramid_beaker. How you get at your settings will be up to you.
if settings['beaker.session.type'] == 'ext:redis' and settings['beaker.session.url'] == 'custom':
from redis import StrictRedis
db = StrictRedis(host='127.0.0.1', port=6379, password = 'my#pass', db = 1)
db.ping()
db.set('_startup','_test')
settings['beaker.session.url'] = db
session_factory = session_factory_from_settings(settings)
config.set_session_factory(session_factory)
Obviously another workaround is to not have a password with symbols 😄
If your password for Redis AUTH has # or : in it, it will need to be url encoded. however, redis-py will not automatically decode the url with the current version.
Redis URLs with passwords are in the form of redis(s)://user:pass@server:port/db
If say you had redis://:my#Pass@127.0.0.1:6379/1 this forms an invalid URL
The solution would be to do something like redis://:my%35Pass@127.0.0.1:6379/1
redis-py supports this, however, versions 3.5.3 and below, from_url must be passed decode_components=True ... it defaults to False for now.
It looks like version 4.x will get rid of this and always decode the url, so we could end up with some compatibility issues if we try and pass it.
I was going to put forth a PR, but SyncDict was passing arguments in unnamed so could cause some issues there down the road. from_url probably won't change as far as URL being the first param.
The workaround is to construct your own StrictRedis ( really just Redis now ) and pass it. Already doing that do deal with SSL when the cert can't be verified, but an issue.
Looks a little something like this...I'm using pyramid and pyramid_beaker. How you get at your settings will be up to you.
Obviously another workaround is to not have a password with symbols 😄