Skip to content

Instantly share code, notes, and snippets.

@tague
Created June 5, 2018 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tague/416405bf6427f8646107bfa10e1b4736 to your computer and use it in GitHub Desktop.
Save tague/416405bf6427f8646107bfa10e1b4736 to your computer and use it in GitHub Desktop.
Sample Python SSL Redis Program
#!/usr/local/bin/python3
import redis
import pprint
try:
r = redis.StrictRedis(
decode_responses=True,
host='redis-16148.c15.us-east-1-2.ec2.cloud.redislabs.com',
port=16148,
password='sekret',
ssl=True,
ssl_keyfile='./redislabs_user_private.key',
ssl_certfile='./redislabs_user.crt',
ssl_cert_reqs='required',
ssl_ca_certs='./redislabs_ca.pem',
)
info = r.info()
pprint.pprint(info)
except Exception as err:
print("Error connecting to Redis: {}".format(err))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment