Spaces:
Sleeping
Sleeping
| import redis | |
| try: | |
| client = redis.StrictRedis(host='127.0.0.1', port=6379, db=0) | |
| # Test the connection by pinging the server | |
| if client.ping(): | |
| print("Successfully connected to Redis!") | |
| else: | |
| print("Failed to connect to Redis.") | |
| except Exception as e: | |
| print(f"Error connecting to Redis: {e}") | |