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.

31 lines
899 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
def get_local_db_connection():
import psycopg2
from psycopg2.extras import RealDictCursor
conn = psycopg2.connect(
host='192.168.0.27',
port=5432,
dbname='streamaster',
user='oscar',
password='j0cy8c311024x3'
)
cursor = conn.cursor(cursor_factory=RealDictCursor)
return conn, cursor