Redis quoted password


#1

Trying to instal redash I have the next redis url REDASH_REDIS_URL=redis://user:pass/word@redis.cache.windows.net:6379/1 .
Note the / on the password. This gives me the next error:

[2018-01-25 10:49:32 +0000] [16] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 578, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 135, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 352, in import_app
    __import__(module)
  File "/app/redash/__init__.py", line 63, in <module>
    redis_connection = create_redis_connection()
  File "/app/redash/__init__.py", line 57, in create_redis_connection
    r = redis.StrictRedis(host=redis_url.hostname, port=redis_url.port, db=redis_db, password=redis_url.password)
  File "/usr/lib/python2.7/urlparse.py", line 113, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'pass' 

If I quote the password like REDASH_REDIS_URL=redis://user:pass%2Fword@redis.cache.windows.net:6379/1 then I get ResponseError: invalid password.

Having a look to redash redis connection code you have password=redis_url.password. Something like password=urllib.unquote(redis_url.password) could fix the issue. Are there any workarounds to this issue or something else I am missing? Should I open a issue on github?


#2

Checked the documentation of urlparse.urlparse and it explicitly doesn’t unescape values, so unquote is indeed needed. Instead of opening an issue, you can just submit the pull request :slight_smile:


#3

There you go :wink: