How to use the hiredis.hiredis.ReplyError function in hiredis

To help you get started, we’ve selected a few hiredis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github projecteru / redis-ctl / app / bps / redis.py View on Github external
@bp.route_post_json('/add', True)
def add_redis():
    host = request.form['host']
    port = int(request.form['port'])
    # do some necessary validation
    status = 0
    reason = 'success'
    try:
        with Connection(host, port) as t:
            try:
                info = t.talk("info")
                info_dict = parse_config(info)
                if info_dict['cluster_enabled'] == '0':
                    status = 3
                    reason = 'not in cluster mode'
            except ReplyError as e:
                reason = e.message
                status = 2
    except IOError, e:
        status = 1
        reason = e.message
    if status == 0:
        models.node.create_instance(host, port)
        models.audit.raw_event(host, port, models.audit.EVENT_TYPE_CREATE,
                               bp.app.get_user_id())
    return {'reason': reason, 'status': status}

hiredis

Python wrapper for hiredis

MIT
Latest version published 4 months ago

Package Health Score

84 / 100
Full package analysis

Similar packages