Skip to content

Xopherus/redis-url-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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://:[email protected]:6379/0')

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

Clustered Redis

redis_url_py.parse('redis://:[email protected]: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.