Skip to content

Commit 911aa37

Browse files
dvora-hdependabot[bot]d184230d184230kristjanvalur
authored
Cherry pick for v5.0.2 (#3159)
* Bump actions/checkout from 3 to 4 (#2969) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rojopolis/spellcheck-github-actions from 0.33.1 to 0.34.0 (#2970) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix type hint (#2963) Co-authored-by: d184230 <dubkov.a@skbkontur.ru> * Don't perform blocking connect inside the BlockingConnectionQueue Condition variable. (#2997) * Creating CODEOWNERS for the examples (#2993) * Close various objects created during asyncio tests (#3005) * Close various objects created during asyncio tests * Fix resource leake in test_cwe_404.py Need to wait for individual handler tasks when shutting down server. * Linking to Redis resources (#3006) * Add GEOSHAPE field type for index creation of RediSearch (#2957) * first pass of geoshape index type * first attempt at test, but demonstrates the initial commit is broken * fix new field + fix tests * work on linter * more linter * try to mark test with correct fixture * fix linter * Better deal with "lost" connections for async Redis (#2999) * Allow tracking/reporting and closing of "lost" connections. ConnectionPool keeps a WeakSet of in_use connections, allowing lost ones to be collected. Collection produces a warning and closes the underlying transport. * Add tests for the __del__ handlers of async Redis and Connection objects * capture expected warnings in the test * lint * Update client.py sleep_time typing for run_in_thread function (#2977) Changed from `sleep_time: int = 0` to `sleep_time: float = 0.0` To avoid Pylance complaining: `Argument of type "float" cannot be assigned to parameter "sleep_time" of type "int" in function "run_in_thread" "float" is incompatible with "int"` * Fix BlockingConnectionPool.from_url parsing of timeout in query args #2983 (#2984) Co-authored-by: Romain Fliedel <romain@oqee.tv> * Fix parsing resp3 dicts (#2982) * Update ocsp.py (#3022) * Bump rojopolis/spellcheck-github-actions from 0.34.0 to 0.35.0 (#3060) Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.34.0 to 0.35.0. - [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases) - [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md) - [Commits](rojopolis/spellcheck-github-actions@0.34.0...0.35.0) --- updated-dependencies: - dependency-name: rojopolis/spellcheck-github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Use `disable_decoding` in async `read_response`. (#3042) * Add "sum" to DUPLICATE_POLICY documentation of TS.CREATE, TS.ADD and TS.ALTER (#3027) * Update advanced_features.rst (#3019) * Fix typos. (#3016) * Fix parsing of `FT.PROFILE` result (#3063) * Fix parsing of ft.profile result * test * Make the connection callback methods public again, add documentation (#2980) * Fix reported version of deprecations in asyncio.client (#2968) * Allow the parsing of the asking command to forward original options (#3012) Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> * Fix Specifying Target Nodes broken hyperlink (#3072) The typo cause hyperlinks to fail. * Fix return types in json commands (#3071) * Fix return types in JSONCommands class * Update CHANGES * fix acl_genpass with bits (#3062) * Bump github/codeql-action from 2 to 3 (#3096) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/upload-artifact from 3 to 4 (#3097) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/setup-python from 4 to 5 (#3095) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Always sending codecov (#3101) * filter commits for main branch (#3036) * fix(docs): organize cluster mode part of lua scripting (#3073) * Fix typing for `HashCommand.hdel` (#3029) Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> * Adding lock_name to LockError (#3023) * Adding lock_name to LockError * Adding lock_name to LockError --------- Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> * Fix objlen type hint (#2966) * Fix objlen type hint * Update redis/commands/json/commands.py Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> * linters --------- Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> * Fix type hint of arbitrary argument lists (#2908) * Fix: hset unexpectedly mutates the list passed to items (#3103) * Fix possible pipeline connections leak (#3104) * Update cluster.py When Executing "n.write()" may generate some unknown errors(e.g. DataError), which could result in the connection not being released. * Update cluster.py * Update cluster.py release connection move to "try...finally" * Update cluster.py fix the linters * fix problems of code review * Add modules support to async RedisCluster (#3115) * Fix grammer in BlockingConnectionPool class documentation (#3120) Co-authored-by: ahmedabdou14 <root@xps> * release already acquired connections on ClusterPipeline, when get_connection raises an exception (#3133) Signed-off-by: zach.lee <zach.lee@sendbird.com> * Bump actions/stale from 3 to 9 (#3132) Bumps [actions/stale](https://github.com/actions/stale) from 3 to 9. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](actions/stale@v3...v9) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump codecov/codecov-action from 3 to 4 (#3131) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Allow to control the minimum SSL version (#3127) * Allow to control the minimum SSL version It's useful for applications that has strict security requirements. * Add tests for minimum SSL version The commit updates test_tcp_ssl_connect for both sync and async connections. Now it sets the minimum SSL version. The test is ran with both TLSv1.2 and TLSv1.3 (if supported). A new test case is test_tcp_ssl_version_mismatch. The test added for both sync and async connections. It uses TLS 1.3 on the client side, and TLS 1.2 on the server side. It expects a connection error. The test is skipped if TLS 1.3 is not supported. * Add example of using a minimum TLS version * docs: Add timeout parameter for get_message example (#3129) The `get_message()` method in asyncio PubSub has a `timeout` argument that defaults to 0.0, causing it to immediately return. This can cause high CPU usage with the given code example and should not be recommended. By setting `timeout=None`, it works with much more efficient resource usage. * Revert stale isuue version update (#3142) * Update connection.py (#3149) Exception ignored in: <function Redis.__del__ at ...> Traceback .... TypeError: 'NoneType' object cannot be interpreted as an integer. This happens when closing the connection within a spawned Process (multiprocess). * Fix retry logic for pubsub and pipeline (#3134) * Fix retry logic for pubsub and pipeline Extend the fix from bea7299 to apply to pipeline and pubsub as well. Fixes #2973 * fix isort --------- Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> * Update install_requires (#3109) --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: zach.lee <zach.lee@sendbird.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Artem Diubkov <d184230@gmail.com> Co-authored-by: d184230 <dubkov.a@skbkontur.ru> Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com> Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: Shaya Potter <spotter@gmail.com> Co-authored-by: Bosheng (Daniel) Zhang <740807262@qq.com> Co-authored-by: Romain <r0ro@users.noreply.github.com> Co-authored-by: Romain Fliedel <romain@oqee.tv> Co-authored-by: Aniket Patil <128228805+AniketP04@users.noreply.github.com> Co-authored-by: Stanisław Denkowski <mr.denkov@gmail.com> Co-authored-by: Pedram Parsian <pedram.parsian@gmail.com> Co-authored-by: BackflipPenguin <63213817+BackflipPenguin@users.noreply.github.com> Co-authored-by: AYMEN Mohammed <53928879+AYMENJD@users.noreply.github.com> Co-authored-by: Zachary Ware <zachary.ware@gmail.com> Co-authored-by: Tyler Bream (Event pipeline) <97038416+tbbream@users.noreply.github.com> Co-authored-by: Binbin <binloveplay1314@qq.com> Co-authored-by: Pármenas Haniel <42049025+parmenashp@users.noreply.github.com> Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com> Co-authored-by: Dmitry Kulazhenko <dmkulazhenko@gmail.com> Co-authored-by: Dan Lousqui <github@blusky.fr> Co-authored-by: trkwyk <50520795+trkwyk@users.noreply.github.com> Co-authored-by: SwordHeart <37992593+zxjlm@users.noreply.github.com> Co-authored-by: Jason <31104990+ING-XIAOJIAN@users.noreply.github.com> Co-authored-by: Ahmed Ashraf <104530599+ahmedabdou14@users.noreply.github.com> Co-authored-by: ahmedabdou14 <root@xps> Co-authored-by: Dongkeun Lee <3315213+zakaf@users.noreply.github.com> Co-authored-by: poiuj <1099644+poiuj@users.noreply.github.com> Co-authored-by: Qiangning Hong <hongqn@gmail.com> Co-authored-by: wKollendorf <83725977+wKollendorf@users.noreply.github.com> Co-authored-by: Will Miller <w-miller@users.noreply.github.com>
1 parent cc4bc1a commit 911aa37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+723
-321
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
doctests/* @dmaier-redislabs

.github/release-drafter-config.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name-template: '$NEXT_MINOR_VERSION'
22
tag-template: 'v$NEXT_MINOR_VERSION'
3+
filter-by-commitish: true
4+
commitish: master
35
autolabeler:
46
- label: 'maintenance'
57
files:
@@ -15,7 +17,7 @@ autolabeler:
1517
branch:
1618
- '/feature-.+'
1719
categories:
18-
- title: 'Breaking Changes'
20+
- title: '🔥 Breaking Changes'
1921
labels:
2022
- 'breakingchange'
2123
- title: '🧪 Experimental Features'
@@ -32,7 +34,12 @@ categories:
3234
- 'bug'
3335
- 'BUG'
3436
- title: '🧰 Maintenance'
35-
label: 'maintenance'
37+
labels:
38+
- 'maintenance'
39+
- 'dependencies'
40+
- 'documentation'
41+
- 'docs'
42+
- 'testing'
3643
change-template: '- $TITLE (#$NUMBER)'
3744
exclude-labels:
3845
- 'skip-changelog'

.github/workflows/codeql-analysis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ jobs:
3636

3737
steps:
3838
- name: Checkout repository
39-
uses: actions/checkout@v3
39+
uses: actions/checkout@v4
4040

4141
# Initializes the CodeQL tools for scanning.
4242
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@v2
43+
uses: github/codeql-action/init@v3
4444
with:
4545
languages: ${{ matrix.language }}
4646
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -51,7 +51,7 @@ jobs:
5151
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5252
# If this step fails, then you should remove it and run the build manually (see below)
5353
- name: Autobuild
54-
uses: github/codeql-action/autobuild@v2
54+
uses: github/codeql-action/autobuild@v3
5555

5656
# ℹ️ Command-line programs to run using the OS shell.
5757
# 📚 https://git.io/JvXDl
@@ -65,4 +65,4 @@ jobs:
6565
# make release
6666

6767
- name: Perform CodeQL Analysis
68-
uses: github/codeql-action/analyze@v2
68+
uses: github/codeql-action/analyze@v3

.github/workflows/docs.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
name: Build docs
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v3
29-
- uses: actions/setup-python@v4
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-python@v5
3030
with:
3131
python-version: 3.9
3232
cache: 'pip'
@@ -40,7 +40,7 @@ jobs:
4040
invoke build-docs
4141
4242
- name: upload docs
43-
uses: actions/upload-artifact@v3
43+
uses: actions/upload-artifact@v4
4444
with:
4545
name: redis-py-docs
4646
path: |

.github/workflows/integration.yaml

+13-14
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
name: Dependency audit
3030
runs-on: ubuntu-latest
3131
steps:
32-
- uses: actions/checkout@v3
32+
- uses: actions/checkout@v4
3333
- uses: pypa/gh-action-pip-audit@v1.0.8
3434
with:
3535
inputs: requirements.txt dev_requirements.txt
@@ -40,8 +40,8 @@ jobs:
4040
name: Code linters
4141
runs-on: ubuntu-latest
4242
steps:
43-
- uses: actions/checkout@v3
44-
- uses: actions/setup-python@v4
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-python@v5
4545
with:
4646
python-version: 3.9
4747
cache: 'pip'
@@ -64,8 +64,8 @@ jobs:
6464
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
6565
name: Python ${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} tests
6666
steps:
67-
- uses: actions/checkout@v3
68-
- uses: actions/setup-python@v4
67+
- uses: actions/checkout@v4
68+
- uses: actions/setup-python@v5
6969
with:
7070
python-version: ${{ matrix.python-version }}
7171
cache: 'pip'
@@ -81,15 +81,14 @@ jobs:
8181
sleep 10 # time to settle
8282
invoke ${{matrix.test-type}}-tests
8383
84-
- uses: actions/upload-artifact@v3
84+
- uses: actions/upload-artifact@v4
8585
if: success() || failure()
8686
with:
8787
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}
8888
path: '${{matrix.test-type}}*results.xml'
8989

9090
- name: Upload codecov coverage
91-
uses: codecov/codecov-action@v3
92-
if: ${{matrix.python-version == '3.11'}}
91+
uses: codecov/codecov-action@v4
9392
with:
9493
fail_ci_if_error: false
9594

@@ -119,8 +118,8 @@ jobs:
119118
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
120119
name: RESP3 [${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}]
121120
steps:
122-
- uses: actions/checkout@v3
123-
- uses: actions/setup-python@v4
121+
- uses: actions/checkout@v4
122+
- uses: actions/setup-python@v5
124123
with:
125124
python-version: ${{ matrix.python-version }}
126125
cache: 'pip'
@@ -146,8 +145,8 @@ jobs:
146145
matrix:
147146
extension: ['tar.gz', 'whl']
148147
steps:
149-
- uses: actions/checkout@v3
150-
- uses: actions/setup-python@v4
148+
- uses: actions/checkout@v4
149+
- uses: actions/setup-python@v5
151150
with:
152151
python-version: 3.9
153152
- name: Run installed unit tests
@@ -162,8 +161,8 @@ jobs:
162161
matrix:
163162
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9']
164163
steps:
165-
- uses: actions/checkout@v3
166-
- uses: actions/setup-python@v4
164+
- uses: actions/checkout@v4
165+
- uses: actions/setup-python@v5
167166
with:
168167
python-version: ${{ matrix.python-version }}
169168
cache: 'pip'

.github/workflows/pypi-publish.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
build_and_package:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- name: install python
17-
uses: actions/setup-python@v4
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: 3.9
2020
- name: Install dev tools

.github/workflows/spellcheck.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout
9-
uses: actions/checkout@v3
9+
uses: actions/checkout@v4
1010
- name: Check Spelling
11-
uses: rojopolis/spellcheck-github-actions@0.33.1
11+
uses: rojopolis/spellcheck-github-actions@0.35.0
1212
with:
1313
config_path: .github/spellcheck-settings.yml
1414
task_name: Markdown

CHANGES

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* Allow to control the minimum SSL version
2+
* Add an optional lock_name attribute to LockError.
3+
* Fix return types for `get`, `set_path` and `strappend` in JSONCommands
4+
* Connection.register_connect_callback() is made public.
5+
* Fix async `read_response` to use `disable_decoding`.
16
* Add 'aclose()' methods to async classes, deprecate async close().
27
* Fix #2831, add auto_close_connection_pool=True arg to asyncio.Redis.from_url()
38
* Fix incorrect redis.asyncio.Cluster type hint for `retry_on_error`
@@ -55,6 +60,7 @@
5560
* Fix for Unhandled exception related to self.host with unix socket (#2496)
5661
* Improve error output for master discovery
5762
* Make `ClusterCommandsProtocol` an actual Protocol
63+
* Add `sum` to DUPLICATE_POLICY documentation of `TS.CREATE`, `TS.ADD` and `TS.ALTER`
5864

5965
* 4.1.3 (Feb 8, 2022)
6066
* Fix flushdb and flushall (#1926)

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ The Python interface to the Redis key-value store.
1717

1818
---------------------------------------------
1919

20+
## How do I Redis?
21+
22+
[Learn for free at Redis University](https://university.redis.com/)
23+
24+
[Build faster with the Redis Launchpad](https://launchpad.redis.com/)
25+
26+
[Try the Redis Cloud](https://redis.com/try-free/)
27+
28+
[Dive in developer tutorials](https://developer.redis.com/)
29+
30+
[Join the Redis community](https://redis.com/community/)
31+
32+
[Work at Redis](https://redis.com/company/careers/jobs/)
33+
2034
## Installation
2135

2236
Start a redis via docker:

docs/advanced_features.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ running.
346346
347347
The third option runs an event loop in a separate thread.
348348
pubsub.run_in_thread() creates a new thread and starts the event loop.
349-
The thread object is returned to the caller of [un_in_thread(). The
349+
The thread object is returned to the caller of run_in_thread(). The
350350
caller can use the thread.stop() method to shut down the event loop and
351351
thread. Behind the scenes, this is simply a wrapper around get_message()
352352
that runs in a separate thread, essentially creating a tiny non-blocking

docs/clustering.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The ‘target_nodes’ parameter is explained in the following section,
9292
>>> # target-node: default-node
9393
>>> rc.ping()
9494
95-
Specfiying Target Nodes
95+
Specifying Target Nodes
9696
-----------------------
9797

9898
As mentioned above, all non key-based RedisCluster commands accept the

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686

8787
# List of patterns, relative to source directory, that match files and
8888
# directories to ignore when looking for source files.
89-
exclude_patterns = ["_build", "**.ipynb_checkponts"]
89+
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
9090

9191
# The reST default role (used for this markup: `text`) to use for all
9292
# documents.

docs/examples/asyncio_examples.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
"\n",
202202
"async def reader(channel: redis.client.PubSub):\n",
203203
" while True:\n",
204-
" message = await channel.get_message(ignore_subscribe_messages=True)\n",
204+
" message = await channel.get_message(ignore_subscribe_messages=True, timeout=None)\n",
205205
" if message is not None:\n",
206206
" print(f\"(Reader) Message Received: {message}\")\n",
207207
" if message[\"data\"].decode() == STOPWORD:\n",
@@ -264,7 +264,7 @@
264264
"\n",
265265
"async def reader(channel: redis.client.PubSub):\n",
266266
" while True:\n",
267-
" message = await channel.get_message(ignore_subscribe_messages=True)\n",
267+
" message = await channel.get_message(ignore_subscribe_messages=True, timeout=None)\n",
268268
" if message is not None:\n",
269269
" print(f\"(Reader) Message Received: {message}\")\n",
270270
" if message[\"data\"].decode() == STOPWORD:\n",

docs/examples/pipeline_examples.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"cell_type": "markdown",
124124
"metadata": {},
125125
"source": [
126-
"The responses of the three commands are stored in a list. In the above example, the two first boolean indicates that the `set` commands were successfull and the last element of the list is the result of the `get(\"a\")` comand."
126+
"The responses of the three commands are stored in a list. In the above example, the two first boolean indicates that the `set` commands were successful and the last element of the list is the result of the `get(\"a\")` comand."
127127
]
128128
},
129129
{

docs/examples/ssl_connection_examples.ipynb

+36
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,42 @@
7676
"ssl_connection.ping()"
7777
]
7878
},
79+
{
80+
"cell_type": "markdown",
81+
"metadata": {},
82+
"source": [
83+
"## Connecting to a Redis instance via SSL, while specifying a minimum TLS version"
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": null,
89+
"metadata": {},
90+
"outputs": [
91+
{
92+
"data": {
93+
"text/plain": [
94+
"True"
95+
]
96+
},
97+
"execution_count": 6,
98+
"metadata": {},
99+
"output_type": "execute_result"
100+
}
101+
],
102+
"source": [
103+
"import redis\n",
104+
"import ssl\n",
105+
"\n",
106+
"ssl_conn = redis.Redis(\n",
107+
" host=\"localhost\",\n",
108+
" port=6666,\n",
109+
" ssl=True,\n",
110+
" ssl_min_version=ssl.TLSVersion.TLSv1_3,\n",
111+
")\n",
112+
"ssl_conn.ping()"
113+
]
114+
},
79115
{
80116
"cell_type": "markdown",
81117
"metadata": {},

docs/lua_scripting.rst

+19-14
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,24 @@ Cluster Mode
9292

9393
Cluster mode has limited support for lua scripting.
9494

95-
The following commands are supported, with caveats: - ``EVAL`` and
96-
``EVALSHA``: The command is sent to the relevant node, depending on the
97-
keys (i.e., in ``EVAL "<script>" num_keys key_1 ... key_n ...``). The
98-
keys *must* all be on the same node. If the script requires 0 keys, *the
99-
command is sent to a random (primary) node*. - ``SCRIPT EXISTS``: The
100-
command is sent to all primaries. The result is a list of booleans
101-
corresponding to the input SHA hashes. Each boolean is an AND of “does
102-
the script exist on each node?”. In other words, each boolean is True
103-
iff the script exists on all nodes. - ``SCRIPT FLUSH``: The command is
104-
sent to all primaries. The result is a bool AND over all nodes’
105-
responses. - ``SCRIPT LOAD``: The command is sent to all primaries. The
106-
result is the SHA1 digest.
107-
108-
The following commands are not supported: - ``EVAL_RO`` - ``EVALSHA_RO``
95+
The following commands are supported, with caveats:
96+
97+
- ``EVAL`` and ``EVALSHA``: The command is sent to the relevant node,
98+
depending on the keys (i.e., in ``EVAL "<script>" num_keys key_1 ...
99+
key_n ...``). The keys *must* all be on the same node. If the script
100+
requires 0 keys, *the command is sent to a random (primary) node*.
101+
- ``SCRIPT EXISTS``: The command is sent to all primaries. The result
102+
is a list of booleans corresponding to the input SHA hashes. Each
103+
boolean is an AND of “does the script exist on each node?”. In other
104+
words, each boolean is True iff the script exists on all nodes.
105+
- ``SCRIPT FLUSH``: The command is sent to all primaries. The result
106+
is a bool AND over all nodes’ responses.
107+
- ``SCRIPT LOAD``: The command is sent to all primaries. The result
108+
is the SHA1 digest.
109+
110+
The following commands are not supported:
111+
112+
- ``EVAL_RO``
113+
- ``EVALSHA_RO``
109114

110115
Using scripting within pipelines in cluster mode is **not supported**.

redis/_parsers/helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def float_or_none(response):
322322
return float(response)
323323

324324

325-
def bool_ok(response):
325+
def bool_ok(response, **options):
326326
return str_if_bytes(response) == "OK"
327327

328328

redis/_parsers/hiredis.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,16 @@ async def read_response(
198198
if not self._connected:
199199
raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None
200200

201-
response = self._reader.gets()
201+
if disable_decoding:
202+
response = self._reader.gets(False)
203+
else:
204+
response = self._reader.gets()
202205
while response is False:
203206
await self.read_from_socket()
204-
response = self._reader.gets()
207+
if disable_decoding:
208+
response = self._reader.gets(False)
209+
else:
210+
response = self._reader.gets()
205211

206212
# if the response is a ConnectionError or the response is a list and
207213
# the first item is a ConnectionError, raise it as something bad

0 commit comments

Comments
 (0)