Skip to content

Instantly share code, notes, and snippets.

@maguec
Created May 28, 2019 21:41
Show Gist options
  • Save maguec/37c493a7d2e50417ad5ac72513c31655 to your computer and use it in GitHub Desktop.
Save maguec/37c493a7d2e50417ad5ac72513c31655 to your computer and use it in GitHub Desktop.
Python SSL Connection
import redis
'''
The Cert comes from /etc/opt/redislabs/proxy_cert.pem!
'''
redis_host = '1.2.3.4'
redis_port = 14873
redis_password = 'MyPassword'
try:
conn2 = redis.StrictRedis(
host=redis_host,
port=redis_port,
ssl=True,
password=redis_password,
ssl_ca_certs='./cert.pem',
)
print conn2.ping()
except Exception as ex:
print 'Error:', ex
exit('Failed to connect, terminating.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment