Created
May 28, 2019 21:41
-
-
Save maguec/37c493a7d2e50417ad5ac72513c31655 to your computer and use it in GitHub Desktop.
Python SSL Connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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