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

TypeError when running ssl example from documentation #3217

Open
boris-garvis opened this issue Apr 26, 2024 · 1 comment · May be fixed by #3226
Open

TypeError when running ssl example from documentation #3217

boris-garvis opened this issue Apr 26, 2024 · 1 comment · May be fixed by #3226
Assignees

Comments

@boris-garvis
Copy link

Version: What redis-py and what redis version is the issue happening on?
5.0.4
Platform: What platform / version? (For example Python 3.5.1 on Windows 7 / Ubuntu 15.10 / Azure)
Ubuntu 20.04, python 3.8
Description: Description of your issue, stack traces from errors and code that reproduces the issue
When running example of ssl connection using url TypeError is thrown TypeError: __init__() got an unexpected keyword argument 'ssl_cert_reqs'

Link to documentation https://redis-py.readthedocs.io/en/stable/examples/ssl_connection_examples.html#Connecting-to-a-Redis-instance-via-a-URL-string

In [5]: redis.__version__
Out[5]: '5.0.4'

In [6]: url_connection = redis.from_url("redis://localhost:6379?ssl_cert_reqs=none&decode_responses=True&health_check_interval=2")
   ...: url_connection.ping()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
~/anaconda3/lib/python3.8/site-packages/redis/connection.py in get_connection(self, command_name, *keys, **options)
   1101             try:
-> 1102                 connection = self._available_connections.pop()
   1103             except IndexError:

IndexError: pop from empty list

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-6-ca21524ef001> in <module>
      1 url_connection = redis.from_url("redis://localhost:6379?ssl_cert_reqs=none&decode_responses=True&health_check_interval=2")
----> 2 url_connection.ping()

~/anaconda3/lib/python3.8/site-packages/redis/commands/core.py in ping(self, **kwargs)
   1215         For more information see https://redis.io/commands/ping
   1216         """
-> 1217         return self.execute_command("PING", **kwargs)
   1218 
   1219     def quit(self, **kwargs) -> ResponseT:

~/anaconda3/lib/python3.8/site-packages/redis/client.py in execute_command(self, *args, **options)
    540         pool = self.connection_pool
    541         command_name = args[0]
--> 542         conn = self.connection or pool.get_connection(command_name, **options)
    543 
    544         try:

~/anaconda3/lib/python3.8/site-packages/redis/connection.py in get_connection(self, command_name, *keys, **options)
   1102                 connection = self._available_connections.pop()
   1103             except IndexError:
-> 1104                 connection = self.make_connection()
   1105             self._in_use_connections.add(connection)
   1106 

~/anaconda3/lib/python3.8/site-packages/redis/connection.py in make_connection(self)
   1142             raise ConnectionError("Too many connections")
   1143         self._created_connections += 1
-> 1144         return self.connection_class(**self.connection_kwargs)
   1145 
   1146     def release(self, connection: "Connection") -> None:

~/anaconda3/lib/python3.8/site-packages/redis/connection.py in __init__(self, host, port, socket_keepalive, socket_keepalive_options, socket_type, **kwargs)
    591         self.socket_keepalive_options = socket_keepalive_options or {}
    592         self.socket_type = socket_type
--> 593         super().__init__(**kwargs)
    594 
    595     def repr_pieces(self):

TypeError: __init__() got an unexpected keyword argument 'ssl_cert_reqs'
@gerzse gerzse linked a pull request May 9, 2024 that will close this issue
6 tasks
@gerzse gerzse self-assigned this May 9, 2024
@gerzse
Copy link
Contributor

gerzse commented May 9, 2024

@boris-garvis Thanks for reporting this. Not only the documentation was off, also the test certificates had some issues.

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 a pull request may close this issue.

2 participants