Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:

run-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
max-parallel: 6
matrix:
Expand Down
3 changes: 2 additions & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Examples
:maxdepth: 3
:glob:

examples/connection_example
examples/connection_examples
examples/ssl_connection_examples
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
"# Connection Examples"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import redis"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -40,6 +31,8 @@
}
],
"source": [
"import redis\n",
"\n",
"connection = redis.Redis()\n",
"connection.ping()"
]
Expand Down Expand Up @@ -68,8 +61,10 @@
}
],
"source": [
"decode_connection = redis.Redis(decode_responses=True)\n",
"connection.ping()"
"import redis\n",
"\n",
"decoded_connection = redis.Redis(decode_responses=True)\n",
"decoded_connection.ping()"
]
},
{
Expand All @@ -96,82 +91,12 @@
}
],
"source": [
"import redis\n",
"\n",
"user_connection = redis.Redis(host='localhost', port=6380, username='dvora', password='redis', decode_responses=True)\n",
"user_connection.ping()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Connecting to a Redis instance via SSL."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ssl_connection = redis.Redis(host='localhost', port=6666, ssl=True, ssl_cert_reqs=\"none\")\n",
"ssl_connection.ping()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Connecting to a Redis instance via SSL, while specifying a self-signed SSL certificate."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os\n",
"\n",
"ROOT = os.path.join(os.getcwd(), \"..\", \"..\")\n",
"CERT_DIR = os.path.abspath(os.path.join(ROOT, \"docker\", \"stunnel\", \"keys\"))\n",
"ssl_certfile=os.path.join(CERT_DIR, \"server-cert.pem\")\n",
"ssl_keyfile=os.path.join(CERT_DIR, \"server-key.pem\")\n",
"ssl_ca_certs=os.path.join(CERT_DIR, \"server-cert.pem\")\n",
"\n",
"ssl_cert_conn = redis.Redis(\n",
" host=\"localhost\",\n",
" port=6666,\n",
" ssl=True,\n",
" ssl_certfile=ssl_certfile,\n",
" ssl_keyfile=ssl_keyfile,\n",
" ssl_cert_reqs=\"required\",\n",
" ssl_ca_certs=ssl_ca_certs,\n",
")\n",
"ssl_cert_conn.ping()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -203,7 +128,7 @@
}
],
"source": [
"url_connection = redis.from_url(\"rediss://localhost:6666?ssl_cert_reqs=none&decode_responses=True&health_check_interval=2\")\n",
"url_connection = redis.from_url(\"redis://localhost:6379?decode_responses=True&health_check_interval=2\")\n",
"\n",
"url_connection.ping()"
]
Expand Down
Loading