summaryrefslogtreecommitdiff
path: root/redis/connection.py
Commit message (Collapse)AuthorAgeFilesLines
* Support for specifying error types with retry (#1817)Bar Shaul2021-12-231-4/+23
|
* Support for password-encrypted SSL private keys (#1782)Chayim2021-12-161-4/+31
| | | Adding support for SSL private keys with a password. This PR also adds support for future SSL tests.
* close socket after server disconnect (#1797)Paul Brown2021-12-161-2/+7
|
* Support SYNC and PSYNC (#1741)Avital Fine2021-12-151-1/+1
| | | Co-authored-by: Chayim <chayim@users.noreply.github.com>
* Ensure redis_connect_func is set on uds connection (#1794)Ali-Akber Saifee2021-12-151-1/+3
|
* Allow overriding connection class via keyword arguments (#1752)Maksim Novikov2021-12-021-0/+4
|
* Added black and isort (#1734)Anas2021-11-301-185/+244
|
* Pyupgrade + flynt + f-strings (#1759)Aarni Koskela2021-11-301-34/+31
| | | @akx Thank you so much for this! Thanks again for introducing me to a new tool that I'm sliding into my workflow as well.
* Fixing deprecating distutils (PEP 632) (#1730)Chayim2021-11-251-5/+5
|
* Adding support for non-decodable commands (#1731)Chayim2021-11-251-6/+9
|
* Adding RedisCluster client to support Redis Cluster Mode (#1660)Bar Shaul2021-11-251-6/+23
| | | | Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: Anas <anas.el.amraoui@live.com>
* Better removal of hiredis warning (#1726)Alex Wu2021-11-211-4/+0
| | | Co-authored-by: Alex Wu <alex@anyscale.com>
* removing hiredis warning (#1721)Chayim2021-11-171-5/+0
|
* Fix garbage collection deadlock (#1578)Eugene Morozov2021-11-081-3/+6
|
* Adding vulture for static analysis (#1655)Chayim2021-10-281-1/+0
| | | | | * Adding vulture for static analysis Removing dead code found previously by vulture in local runs.
* Add warning when hiredis not installed. Recommend installation. (#1621)adiamzn2021-10-191-0/+3
|
* Removing packaging dependency (#1626)Chayim2021-10-191-5/+5
|
* Fix `retry` attribute in UnixDomainSocketConnection (#1604)nbraun-amazon2021-10-141-1/+15
|
* Use Version instead of StrictVersion since distutils is deprecated. (#1552)Karthikeyan Singaravelan2021-08-291-5/+5
|
* Add retry mechanism with backoff (#1494)nbraun-amazon2021-08-181-19/+36
|
* All values within Redis URLs are url-unquoted via default.Andy McCurdy2020-08-151-105/+80
| | | | | | | | Prior versions of redis-py supported this by specifying the ``decode_components`` flag to the ``from_url`` functions. This is now done by default and cannot be disabled. Fixes #589
* Remove support for end-of-life Python 2.7 (#1318)Jon Dufresne2020-08-061-82/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove support for end-of-life Python 2.7 Python 2.7 is end of life. It is no longer receiving bug fixes, including for security issues. Python 2.7 went EOL on 2020-01-01. For additional details on support Python versions, see: Supported: https://devguide.python.org/#status-of-python-branches EOL: https://devguide.python.org/devcycle/#end-of-life-branches Removing support for EOL Pythons will reduce testing and maintenance resources while allowing the library to move towards a modern Python 3 style. Python 2.7 users can continue to use the previous version of redis-py. Was able to simplify the code: - Removed redis._compat module - Removed __future__ imports - Removed object from class definition (all classes are new style) - Removed long (Python 3 unified numeric types) - Removed deprecated __nonzero__ method - Use simpler Python 3 super() syntax - Use unified OSError exception - Use yield from syntax Co-authored-by: Andy McCurdy <andy@andymccurdy.com>
* Fix some documentation formattingJon Banafato2020-07-261-19/+20
| | | | | Fix a few broken links and class references, move a docstring, and fix a code block.
* Support for loading, unloading and listing Redis Modules (#1360)Roey Prat2020-07-131-0/+13
| | | | | | | | | | | * Support for loading, unloading and listing Redis Modules * minor fixes for flake * unit test for module list - only the empty use case * ModuleError should inherit from ResponseError rather than RedisError Co-authored-by: Vamsi Atluri <vamc19@gmail.com>
* SentinelConnectionPool plays better with threaded applications.Andy McCurdy2020-06-011-9/+40
| | | | | | | | | Prevent the pool from closing sockets on connections that are actively in use by other threads when the master address changes. Connections returned to the pool that are still connected to the old master will be disconnected gracefully. Fixes #1345
* Restore try/except in __del__ methodsAndy McCurdy2020-05-201-3/+12
| | | | Fixed #1339
* Tune the locking in ConnectionPool.get_connectionAndy McCurdy2020-05-141-21/+22
| | | | | The lock does not need to be held while waiting for the socket to establish and validate the TCP connection.
* Fix typo (missing space) in exception message (#1334)Jon Dufresne2020-04-281-1/+1
|
* Switch to flake8 for static code analysis (#1328)Jon Dufresne2020-04-161-1/+0
| | | | | | | | | flake8 catches a wider net of mistakes than pycodestyle and is more commonly used by the larger community. For example, it catches unused imports, a few of which existed. These have since been removed. Two "noqa" comments were added. One ignores the _compat.py file as it has a large amount of Python version specific code. The second is in utils.py which intentionally does not use an import.
* Fix str/bytes mixup in PythonParser.read_response() (#1324)Jon Dufresne2020-04-131-12/+11
| | | | | | | | | | | | Calling str() on a bytes object can result in a BytesWarning being emitted and usually indicates a mixup between byte and string handling. Now, in the event of an invalid RESP response, use the repr value of the raw response in the exception message. Can further simplify the bytes/str handling by comparing the first byte as a bytes object instead of converting it to str. The bytes literal is available on all supported Pythons. This removes the need for the compatibility function, byte_to_chr().
* Simplify exception handlers (#1319)Jon Dufresne2020-04-111-10/+7
| | | | | | | | | Use the "as" keyword to capture the exception in a variable instead of sys.exc_info(). Re-raise exception with the bare "raise" syntax. Avoid "# noqa: E722" by catching BaseException, which includes all exceptions including SystemExit.
* Support memoryview encoding/decoding as a no-opCody-G2020-02-241-10/+15
| | | | | | | | | | This allows memoryview instances to be passed to Redis command args that expect strings or bytes. The memoryview instance is sent directly to the socket such that there are zero copies made of the underlying data during command packing. Fixes #1265 Fixes #1285
* expand AUTH fallback support to pre-v6 Redis servers.Andy McCurdy2020-02-121-0/+6
| | | | Ref #1274
* Stop hiding errors that occur inside __del__ methodsJon Dufresne2020-02-121-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an exception occurs inside the __del__ method, it should be reported to the developer. Not doing so could hide bugs. Python automatically handles exceptions inside __del__ methods, for example: class A: def __del__(self): 1 / 0 A() print("after del") Results in the output: $ python3 ~/blah.py Exception ignored in: <function A.__del__ at 0x7fbbf2bbfc20> Traceback (most recent call last): File "/home/jon/test.py", line 3, in __del__ 1 / 0 ZeroDivisionError: division by zero after del From this example, we can see the bug was not hidden and the code after __del__ still executed. fixes #1281
* Drop unused variables and imports (#1284)Jon Dufresne2020-02-121-1/+1
|
* remove Redis and ConnectionPool __eq__ comparisonAndy McCurdy2020-02-011-6/+0
| | | | | | | | | | | | | After further thought this was a bad idea. Just because two connection pools share the same connection arguments does not make them equal. It would seem quite odd if pool_a == pool_b yet pool_a.disconnect() doesn't close all of pool_b's connections. Ref #1240 Fixes #1277 Fixes #1275 Fixes #1267 Fixes #1273
* Move the username argument in the Redis and Connection classes to the endAndy McCurdy2020-01-311-6/+5
| | | | | | | This helps those poor souls that specify all their connection options as non-keyword arguments. Fixes #1276
* Provide AUTH fallback support for connection URLs with a username componentAndy McCurdy2020-01-311-1/+15
| | | | | | | | | | | | | Prior to ACL support, redis-py ignored the username component of Connection URLs. With ACL support, usernames are no longer ignored and are used to authenticate against an ACL rule. Some cloud vendors with managed Redis instances (like Heroku) provide connection URLs with a username component pre-ACL that is not intended to be used. Sending that username to Redis servers < 6.0.0 results in an error. Attempt to detect this condition and retry the AUTH command with only the password such that authentication continues to work for these users. Fixes #1274
* better thread-safety for ConnectionPool (#1270)Andy McCurdy2020-01-301-43/+120
| | | Better thread and fork safety for ConnectionPool and BlockingConnectionPool
* Slight optimization to command packing.Andy McCurdy2019-12-291-3/+4
| | | | Fixed #1255
* Added the 'ssl_check_hostname' option.Andy McCurdy2019-12-291-2/+5
| | | | | | | | 'ssl_check_hostname' tells SSL Connections to whether to require the TCP hostname to match the hostname specified in the SSL Cert. By default 'ssl_check_hostname' is False to maintain backwards compatibility. Fixed #1196
* more accurate description of acceptable argument typesAndy McCurdy2019-12-291-2/+2
| | | | fixes #1214
* Allow setting client_name during connection construction.Peter van Dijk2019-12-291-15/+31
| | | | | | Client instances and Connection pools now accept "client_name" as an optional argument. If supplied, all connections created will be named via CLIENT SETNAME once the connection to the server is established.
* Added support for ACL commandsAndy McCurdy2019-12-281-14/+27
|
* Fix simple typo: recurrsion -> recursionTim Gates2019-12-071-1/+1
| | | | Closes #1252
* Add equality test on Redis client and conn pool (#1240)Rajiv Bakulesh Shah2019-11-111-0/+6
| | | Add equality test on Redis client and connection pool
* Version 3.3.93.3.9Zac Bristow2019-10-101-5/+7
| | | | | | | | | Fixes SSL read timeouts in Python 2.7 The ssl module in Python 2.7 raises timeouts as ssl.SSLError instead of socket.timeout. When these timeouts are encountered, the error will be re-raised as socket.timeout so it is handled appropriately by the connection.
* version 3.3.7, Fixed a socket.error regression introduced in 3.3.03.3.7Andy McCurdy2019-08-131-4/+16
| | | | | | | Prior versions of 3.3.x could potentially raise a raw socket.error (or one of its subclasses) instead of a redis.exceptions.ConnectionError. Fixes #1202
* version 3.3.6, fixed a regression in 3.3.5 with pubsub timeouts3.3.6Andy McCurdy2019-08-061-0/+8
| | | | Fixes #1200
* version 3.3.5, handle socket.timeout errors correctly in Python 2.73.3.5Andy McCurdy2019-08-021-16/+8
| | | | | Fix an issue where socket.timeout errors could be handled by the wrong exception handler in Python 2.7.