summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChayim I. Kirshen <c@kirshen.com>2022-01-19 10:45:25 +0200
committerChayim I. Kirshen <c@kirshen.com>2022-01-19 10:45:25 +0200
commite7a3a5f363cd3572fe36773d07a178a777e7480a (patch)
tree36faa57db58f5059483e2a7efe1d0237b9f214ae
parentc605690051baff404123e7fe328ac4e50eb00e72 (diff)
downloadredis-py-e7a3a5f363cd3572fe36773d07a178a777e7480a.tar.gz
fixing ssl, json example, and versions
-rw-r--r--docs/conf.py15
-rw-r--r--docs/examples/.ipynb_checkpoints/connection_example-checkpoint.ipynb180
-rw-r--r--docs/examples/ssl_connection_examples.ipynb (renamed from docs/examples/ssl_connecton_examples.ipynb)0
-rw-r--r--docs/redismodules.rst2
4 files changed, 14 insertions, 183 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 0f11442..8bc58e0 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -35,6 +35,12 @@ extensions = [
"sphinx.ext.autosectionlabel",
]
+# AutosectionLabel settings.
+# Uses a <page>:<label> schema which doesn't work for duplicate sub-section
+# labels, so set max depth.
+autosectionlabel_prefix_document = True
+autosectionlabel_maxdepth = 2
+
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
@@ -58,10 +64,13 @@ copyright = "2021, Redis Inc"
# The short X.Y version.
import redis
-version = ".".join(redis.__version__.split(".")[0:2])
+version = ".".join(redis.__version__.split(".")[0:3])
+release = version
+if version == "99.99.99":
+ release = "dev"
-# The full version, including alpha/beta/rc tags.
-release = redis.__version__
+## The full version, including alpha/beta/rc tags.
+#release = redis.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/docs/examples/.ipynb_checkpoints/connection_example-checkpoint.ipynb b/docs/examples/.ipynb_checkpoints/connection_example-checkpoint.ipynb
deleted file mode 100644
index 04de8fe..0000000
--- a/docs/examples/.ipynb_checkpoints/connection_example-checkpoint.ipynb
+++ /dev/null
@@ -1,180 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Connect to redis running locally with default parameters "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 40,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "True\n"
- ]
- }
- ],
- "source": [
- "import redis\n",
- "r = redis.Redis()\n",
- "print(r.ping())"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Overwrite default parameters - connect to redis on specific host and port using username and password"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 39,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "True\n"
- ]
- }
- ],
- "source": [
- "import redis\n",
- "r = redis.Redis(host='localhost', port=6380, username='dvora', password='redis')\n",
- "print(r.ping())"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Create a SSL wrapped TCP socket connection"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 38,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "True\n"
- ]
- }
- ],
- "source": [
- "import redis\n",
- "r = redis.Redis(host='localhost', port=6666, ssl=True, ssl_cert_reqs=\"none\")\n",
- "print(r.ping())"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Add more parameters..."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 37,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "True\n"
- ]
- }
- ],
- "source": [
- "import os\n",
- "import redis\n",
- "\n",
- "ROOT = os.path.join(os.getcwd(), \"..\")\n",
- "CERT_DIR = os.path.abspath(os.path.join(ROOT, \"docker\", \"stunnel\", \"keys\"))\n",
- "\n",
- "r = redis.Redis(\n",
- " host=\"localhost\",\n",
- " port=6666,\n",
- " ssl=True,\n",
- " ssl_certfile=os.path.join(CERT_DIR, \"server-cert.pem\"),\n",
- " ssl_keyfile=os.path.join(CERT_DIR, \"server-key.pem\"),\n",
- " ssl_cert_reqs=\"required\",\n",
- " ssl_ca_certs=os.path.join(CERT_DIR, \"server-cert.pem\"),\n",
- ")\n",
- "print(r.ping())"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Connect to redis client object configured from given URL\n",
- "##### Three URL schemes are supported:\n",
- "\n",
- "##### - `redis://` creates a TCP socket connection. See more at:\n",
- "##### <https://www.iana.org/assignments/uri-schemes/prov/redis>\n",
- "##### - `rediss://` creates a SSL wrapped TCP socket connection. See more at:\n",
- "##### <https://www.iana.org/assignments/uri-schemes/prov/rediss>\n",
- "##### - ``unix://``: creates a Unix Domain Socket connection.\n",
- "\n",
- "##### Parameters are passed through querystring"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 36,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "True\n"
- ]
- }
- ],
- "source": [
- "import redis\n",
- "r = redis.from_url(\"rediss://localhost:6666?ssl_cert_reqs=none\")\n",
- "print(r.ping())"
- ]
- }
- ],
- "metadata": {
- "interpreter": {
- "hash": "d45c99ba0feda92868abafa8257cbb4709c97f1a0b5dc62bbeebdf89d4fad7fe"
- },
- "kernelspec": {
- "display_name": "Python 3 (ipykernel)",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.9.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/docs/examples/ssl_connecton_examples.ipynb b/docs/examples/ssl_connection_examples.ipynb
index 386e4af..386e4af 100644
--- a/docs/examples/ssl_connecton_examples.ipynb
+++ b/docs/examples/ssl_connection_examples.ipynb
diff --git a/docs/redismodules.rst b/docs/redismodules.rst
index 24be4da..2215174 100644
--- a/docs/redismodules.rst
+++ b/docs/redismodules.rst
@@ -109,6 +109,8 @@ These are the commands for interacting with the `RediSearch module <https://redi
.. code-block:: python
import redis
+ from redis.commands.search.field import TextField
+
r = redis.Redis()
r.ft().create_index(TextField("play", weight=5.0), TextField("ball"))
print(r.ft().info())