Пример #1
0
def set_secret_state(path1, path2, path3):
    body = ''
    if path3 is None:
        url = '/secret_set/%s/%s' % (path1, path2)
    else:
        url = '/secret_set/%s/%s/%s' % (path1, path2, path3)
    try:
        body = my_http.get_url(url, my_secret_host, False)  # , True)

    except Exception as inst:
        print "Secret host Problem! {{{0!r}}}".format(inst)
        if url in my_cache:
            return my_cache[url]
    if body == 'Undefined' or body == "Not Allowed":
        return ''
    my_cache[url] = body.lstrip('"').rstrip('"')
    return my_cache[url]
Пример #2
0
def get_secret_state(path1, path2):
    global my_cache
    body = ''
    if path2 is None:
        url = '/secret_get/%s' % (path1)
    else:
        url = '/secret_get/%s/%s' % (path1, path2)
    try:
        body = my_http.get_url(url, my_secret_host, False)
    except Exception as inst:
        print "Secret host Problem! {{{0!r}}}".format(inst)
        if url in my_cache:
            return my_cache[url]
    if body == 'Undefined':
        return ''
    my_cache[url] = body.lstrip('"').rstrip('"')
    return my_cache[url]
Пример #3
0
def get_secret_state(path1, path2):
    global my_cache
    body = ""
    if path2 is None:
        url = "/secret_get/%s" % (path1)
    else:
        url = "/secret_get/%s/%s" % (path1, path2)
    try:
        body = my_http.get_url(url, my_secret_host, False)
    except Exception as inst:
        print "Secret host Problem! {{{0!r}}}".format(inst)
        if url in my_cache:
            return my_cache[url]
    if body == "Undefined":
        return ""
    my_cache[url] = body.lstrip('"').rstrip('"')
    return my_cache[url]
Пример #4
0
def delete_state(path1, path2):
    my_http.get_url('/delete/%s/%s' % (path1, path2), my_secret_host, True)
Пример #5
0
def set_state_incr(path1, path2):
    body = my_http.get_url('/set_incr/%s/%s' % (path1, path2), my_secret_host,
                           True)
    return body.replace('"', '')
Пример #6
0
def set_state_if_less(path1, path2, path3):
    body = my_http.get_url('/set_if_less/%s/%s/%s' % (path1, path2, path3),
                           my_secret_host, True)
    return body.replace('"', '')
Пример #7
0
def delete_state(path1, path2):
    my_http.get_url("/delete/%s/%s" % (path1, path2), my_secret_host, True)
Пример #8
0
def set_state_incr(path1, path2):
    body = my_http.get_url("/set_incr/%s/%s" % (path1, path2), my_secret_host, True)
    return body.replace('"', "")
Пример #9
0
def set_state_if_less(path1, path2, path3):
    body = my_http.get_url("/set_if_less/%s/%s/%s" % (path1, path2, path3), my_secret_host, True)
    return body.replace('"', "")