Exemple #1
0
def get_user_guilds():
    cache = get_keyvalproperty("OAUTH/USERGUILDS/"+str(make_user_cache_key()))
    if cache:
        return cache
    req = discordrest_from_user("/users/@me/guilds")
    if req.status_code != 200:
        abort(req.status_code)
    req = json.dumps(req.json())
    set_keyvalproperty("OAUTH/USERGUILDS/"+str(make_user_cache_key()), req, 250)
    return req
Exemple #2
0
def get_user_guilds():
    cache = redis_store.get("OAUTH/USERGUILDS/" + str(make_user_cache_key()))
    if cache:
        return cache
    req = discordrest_from_user("/users/@me/guilds")
    if req.status_code != 200:
        if hasattr(request, "sid"):
            disconnect()
            return
        abort(req.status_code)
    req = json.dumps(req.json())
    redis_store.set("OAUTH/USERGUILDS/" + str(make_user_cache_key()), req, 250)
    return req