/redis-url-py

Primary LanguagePythonBSD 2-Clause "Simplified" LicenseBSD-2-Clause

redis-url-py

This utility allows you to configure Redis in your Python applications using a url. This library was inspired by needing a way to seamlessly switch between redis-py and redis-py-cluster based on env configuration.

Usage

Non-Clustered Redis

redis_url_py.parse('redis://:password@127.0.0.1:6379/0')

{
    'host': '127.0.0.1',
    'port': 6379,
    'db': 0,
    'password': 'password'
}

Clustered Redis

redis_url_py.parse('redis://:password@127.0.0.1:6379?cluster=true')

{
    'host': '127.0.0.1',
    'port': 6379,
    'password': 'password',
}

Options

You may also specify options in your URL which can be used to configure a redis cluster.