Esempio n. 1
0
def api_key(comment, remove, echo):
    if echo:
        for i in ApiKey.objects():
            print(i.apikey, i.comment)
    elif remove:
        for i in ApiKey.objects(apikey=apikey):
            i.delete()
    elif comment:
        key = uuid4().hex
        ApiKey(apikey=key, comment=comment).save()
        print(key)
    else:
        print("comment or print required")
Esempio n. 2
0
 def decorated_function(*args, **kwargs):
     print(request.headers)
     if 'Apikey' in request.headers:
         if ApiKey.objects(apikey=request.headers.get('Apikey')).first():
             return f(*args, **kwargs)
     return abort(403)