Beispiel #1
0
def _oauth_parse_response(body):
    p = escape.parse_qs(body, keep_blank_values=False)
    token = dict(key=p[b("oauth_token")][0], secret=p[b("oauth_token_secret")][0])

    # Add the extra parameters the Provider included to the token
    special = (b("oauth_token"), b("oauth_token_secret"))
    token.update((k, p[k][0]) for k in p if k not in special)
    return token
Beispiel #2
0
def _oauth_parse_response(body):
    p = escape.parse_qs(body, keep_blank_values=False)
    token = dict(key=p[b("oauth_token")][0], secret=p[b("oauth_token_secret")][0])

    # Add the extra parameters the Provider included to the token
    special = (b("oauth_token"), b("oauth_token_secret"))
    token.update((k, p[k][0]) for k in p if k not in special)
    return token
Beispiel #3
0
    def _oauth_parse_response(self, body, _type):
        p = escape.parse_qs(body, keep_blank_values=False)
        print body, '!!!'
        token = dict(key=p[b('%s_token'%_type)][0], secret=p[b('%s_token_secret'%_type)][0])

        # Add the extra parameters the Provider included to the token
        special = (b('%s_token'%_type), b('%s_token_secret'%_type))
        token.update((k, p[k][0]) for k in p if k not in special)
        return token
Beispiel #4
0
    def _oauth_parse_response(self, body, _type):
        p = escape.parse_qs(body, keep_blank_values=False)
        print body, '!!!'
        token = dict(key=p[b('%s_token' % _type)][0],
                     secret=p[b('%s_token_secret' % _type)][0])

        # Add the extra parameters the Provider included to the token
        special = (b('%s_token' % _type), b('%s_token_secret' % _type))
        token.update((k, p[k][0]) for k in p if k not in special)
        return token
Beispiel #5
0
    def _on_access_token(self, redirect_uri, client_id, client_secret, openkey, 
                         callback, fields, response):
        if response.error:
            logging.warning('Weibo auth error: %s' % str(response))
            callback(None)
            return
        json = escape.parse_qs(response.body)
        session = {
            "access_token": json["access_token"],
            "expires": json.get("expires_in"),
            "openid": ''.join(json.get("openid")),
        }

        self.weibo_request(
            client_id, session["openid"], openkey, 
            callback=self.async_callback(
                self._on_get_user_info, callback, session, fields),
            access_token=session["access_token"],
            fields=",".join(fields)
        )