Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow password keyword to Client #21

Merged
merged 5 commits into from
Sep 13, 2015
Merged

Conversation

jammed343
Copy link
Contributor

Also allows to subclasses, including PubsubClient.

Fixes #20

@@ -20,6 +20,12 @@ class PubSubClient(Client):
"""

def call(self, *args, **kwargs):
if args[0] == 'AUTH':
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to use "_call()" in the connect() method (instead on "call()").

This test would be useless

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

@thefab
Copy link
Owner

thefab commented Aug 20, 2015

can you provide an additional test ?

raise tornado.gen.Return(connection_status)

authentication_status = yield self.call('AUTH', self.password)
if authentication_status == 'OK':
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably b"OK" would be better (python3 compatibility)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

@landscape-bot
Copy link

Code Health
Repository health decreased by 0.06% when pulling a45db8c on jammed343:jammed343-patch-1 into 8480256 on thefab:master.

@jammed343
Copy link
Contributor Author

I have added updates. I tried making some tests for this using requirepass but it has no effect. Although I have manually tested it and it works

thefab added a commit that referenced this pull request Sep 13, 2015
Allow password keyword to Client
@thefab thefab merged commit 3304424 into thefab:master Sep 13, 2015
@masom
Copy link

masom commented Oct 14, 2015

Sorry to re-open this. Seems like passing the password from a Pool does not work:

        self.pool = tornadis.ClientPool(
            max_size=self.context.config.get(
                'REDIS_TORNADO_STORAGE_POOL_MAX_SIZE',
                -1
            ),
            client_timeout=self.context.config.get(
                'REDIS_TORNADO_STORAGE_CLIENT_TIMEOUT',
                -1
            ),
            port=self.context.config.REDIS_STORAGE_SERVER_PORT,
            host=self.context.config.REDIS_STORAGE_SERVER_HOST,
            # db=self.context.config.REDIS_STORAGE_SERVER_DB,
            password=self.context.config.REDIS_STORAGE_SERVER_PASSWORD
        )

raises:

  File "/Users/martin/dev/os/thumbor-community/redis-tornado/tc_redis_tornado/storages/redis_tornado_storage.py", line 51, in exists
    with (yield self.pool.connected_client()) as client:
  File "/Users/martin/venv/thumbor/lib/python2.7/site-packages/tornado/gen.py", line 870, in run
    value = future.result()
  File "/Users/martin/venv/thumbor/lib/python2.7/site-packages/tornadis/utils.py", line 129, in result
    raise self.exception()
TypeError: __init__() got an unexpected keyword argument 'password'

@thefab thefab mentioned this pull request Oct 14, 2015
thefab added a commit that referenced this pull request Oct 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants