Skip to main content

Dictator is a tiny library for Robots to work with Redis as a Dict.

Project description

Dictator is a tiny library for Robots to work with Redis as a Dict.

It handles Redis API commands and represent itself as a dict-like object.


$ pip install dictator


It’s easy to start by creating Dictator object

>>> dc = Dictator(host='localhost', port=6379, db=0)

For the moment it handles not all features of Python Dict but basics:

  • .set(key, value)

    >>> dc.set('Planets', ['Mercury', 'Venus', 'Earth'])
    >>> dc['Stars'] = ['Sun']
  • .get(key)

    >>> dc['Stars']
    >>> dc.get('Planets')
    ['Mercury', 'Venus', 'Earth']

    You can set default value for get() function just like for a dict-object:

    >>> dc.get('Comets', 'No data')
    'No data'
  • .pop(key, default=None)

    >>> dc.pop('Stars')
    >>> dc.pop('Comets')
  • .delete(key)

    >>> dc.delete('Comets')


    >>> del dc['Comets']
  • .keys() and .values()

    >>> dc.keys()
    ['Planets', 'Stars']
    >>> dc.values()
    [['Mercury', 'Venus', 'Earth']]
  • .items()

    >>> dc.iterms()
    [('Planets', ['Mercury', 'Venus', 'Earth'])]
  • also it supports iteration via generator object:

    • .iterkeys()

    • .itervalues()

    • .iteritems()

  • and a bit more!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dictator-0.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page