Пример #1
0
def use_access_token(credentials):
    global user_agents
    if not session['access_token_parts']['oauth_token'] in user_agents:
        credentials.access_token = AccessToken.from_params(
            session['access_token_parts'])
        user_agents[credentials.access_token.key] = LaunchpadClient(credentials)
    is_authorized = True
    session['is_authorized'] = is_authorized
    return (False, None, is_authorized)
Пример #2
0
def use_access_token(credentials):
    global user_agents
    if not session['access_token_parts']['oauth_token'] in user_agents:
        credentials.access_token = AccessToken.from_params(
            session['access_token_parts'])
        user_agents[credentials.access_token.key] = LaunchpadClient(
            credentials)
    is_authorized = True
    session['is_authorized'] = is_authorized
    return (False, None, is_authorized)
Пример #3
0
def get_access_token(credentials):
    global user_agents
    credentials._request_token = AccessToken.from_params(
        session['request_token_parts'])
    request_token_key = credentials._request_token.key
    try:
        credentials.exchange_request_token_for_access_token(LPNET_WEB_ROOT)
    except Exception as e:
        return (False, None, False)
    user_agents[credentials.access_token.key] = LaunchpadClient(credentials)
    session['access_token_parts'] = {
        'oauth_token': credentials.access_token.key,
        'oauth_token_secret': credentials.access_token.secret,
        'lp.context': credentials.access_token.context
    }
    is_authorized = True
    session['is_authorized'] = is_authorized
    del session['request_token_parts']
    return (False, None, is_authorized)
Пример #4
0
def get_access_token(credentials):
    global user_agents
    credentials._request_token = AccessToken.from_params(
        session['request_token_parts'])
    request_token_key = credentials._request_token.key
    try:
        credentials.exchange_request_token_for_access_token(LPNET_WEB_ROOT)
    except Exception as e:
        return (False, None, False)
    user_agents[credentials.access_token.key] = LaunchpadClient(credentials)
    session['access_token_parts'] = {
        'oauth_token': credentials.access_token.key,
        'oauth_token_secret': credentials.access_token.secret,
        'lp.context': credentials.access_token.context
    }
    is_authorized = True
    session['is_authorized'] = is_authorized
    del session['request_token_parts']
    return (False, None, is_authorized)