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

Add username to StrictRedis connection #223

Open
Luferov opened this issue Jul 14, 2023 · 0 comments
Open

Add username to StrictRedis connection #223

Luferov opened this issue Jul 14, 2023 · 0 comments

Comments

@Luferov
Copy link

Luferov commented Jul 14, 2023

Checklist

  • Python version: 3.8.16
  • Using hiredis or just Python parser: yes
  • Using uvloop or just asyncio event loop: yes
  • Does issue exists against the master branch of aredis? Yes

Steps to reproduce

import asyncio
from aredis import StrictRedis

async def example():
    client = StrictRedis(host='127.0.0.1', port=6379, db=0, username='user', password='password')
    await client.flushdb()
    await client.set('foo', 1)
    assert await client.exists('foo') is True
    await client.incr('foo', 100)

    assert int(await client.get('foo')) == 101
    await client.expire('foo', 1)
    await asyncio.sleep(0.1)
    await client.ttl('foo')
    await asyncio.sleep(1)
    assert not await client.exists('foo')

loop = asyncio.get_event_loop()
loop.run_until_complete(example())

Expected behavior

All ok.

Actual behavior

Traceback (most recent call last):
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 415, in connect
    await self._connect()
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 620, in _connect
    await self.on_connect()
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 439, in on_connect
    if nativestr(await self.read_response()) != 'OK':
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 457, in read_response
    raise response
aredis.exceptions.ResponseError: AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Users/victor/PycharmProjects/aredis/aredis/client.py", line 155, in execute_command
    await connection.send_command(*args)
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 488, in send_command
    await self.connect()
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 419, in connect
    raise ConnectionError()
aredis.exceptions.ConnectionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 415, in connect
    await self._connect()
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 620, in _connect
    await self.on_connect()
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 439, in on_connect
    if nativestr(await self.read_response()) != 'OK':
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 457, in read_response
    raise response
aredis.exceptions.ResponseError: AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 21, in <module>
  File "/Users/victor/.pyenv/versions/3.8.16/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "<input>", line 8, in example
  File "/Users/victor/PycharmProjects/aredis/aredis/commands/server.py", line 232, in flushdb
    return await self.execute_command('FLUSHDB')
  File "/Users/victor/PycharmProjects/aredis/aredis/client.py", line 165, in execute_command
    await connection.send_command(*args)
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 488, in send_command
    await self.connect()
  File "/Users/victor/PycharmProjects/aredis/aredis/connection.py", line 419, in connect
    raise ConnectionError()
aredis.exceptions.ConnectionError
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

No branches or pull requests

1 participant