예제 #1
0
def checkApiKey(digest,timestamp):
    k = settings.API_SHARED_KEY 
    t1 = AuthTicket(key=k, timestamp=timestamp, digest=digest, message=timestamp,threshold=60*10)
    if t1.is_valid():
        print "Ticket was valid."
        return True
    else:
        print "Ticket was not valid."
        return False
예제 #2
0
def getApiKey():
    k = settings.API_SHARED_KEY 
    t = AuthTicket(key=k,message=datetime.utcnow().strftime(TIMESTAMP_FORMAT))
    key=dict()
    key['message']=t.message
    key['timestamp']=t.timestamp
    key['digest']=t.digest

    return key