You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
547 B
Python
18 lines
547 B
Python
from redis import Redis
|
|
|
|
redisCred = {"host": "192.168.0.27", "port": 30036, "password": "bignigga123"}
|
|
|
|
def connect_redis():
|
|
try:
|
|
client = Redis(host=redisCred["host"], port=redisCred["port"], password=redisCred["password"])
|
|
|
|
response = client.ping()
|
|
if response:
|
|
print("Connected to Redis successfully!")
|
|
return client
|
|
else:
|
|
print("Failed to connect to Redis!")
|
|
return None
|
|
except Exception as e:
|
|
print(f"An error occurred: {e}")
|
|
return None |