示例#1
0
def add_oauth(**kwargs):
    oauth = OAuthStorage()
    oauth.request_token = kwargs['request_token']
    oauth.user_recognition = kwargs['user_recognition']
    oauth.date = datetime.datetime.now()
    try:
        oauth.save()
    except Exception:
        return None
    return oauth
示例#2
0
def delete_expire_oauth():
    exceed_date = datetime.datetime.now() + datetime.timedelta(seconds=10*60)
    expire_oauth_list = OAuthStorage.get(date__lte=exceed_date)
    for oauth in expire_oauth_list:
        delete_oauth(oauth)
示例#3
0
def get_oauth(**kwargs):
    return OAuthStorage.get(**kwargs)