示例#1
0
 def get_request_token_response(self, redirect_uri, scopes):
     auth = OAuth1Manager(client_key=self.client_id,
                          client_secret=self.client_secret,
                          callback_uri=redirect_uri,
                          signature_method=self.signature_method,
                          signature_type=self.signature_type)
     return self.session.post(self.get_request_token_url(), auth=auth,
                              params=self.get_request_token_params(redirect_uri, scopes),
                              verify=self.verify)
示例#2
0
 def get_access_token_response(self, token, secret, verifier=None):
     auth = OAuth1Manager(client_key=self.client_id,
                          client_secret=self.client_secret,
                          resource_owner_key=token,
                          resource_owner_secret=secret,
                          verifier=verifier,
                          signature_method=self.signature_method,
                          signature_type=self.signature_type)
     return self.session.post(self.get_access_token_url(),auth=auth,
                              verify=self.verify)
示例#3
0
 def api(self, key, domain, path, method='GET', params=None, data=None,
         headers=None):
     protocol = self.https and 'https' or 'http'
     url = '%s://%s%s' % (protocol, domain, path)
     auth = OAuth1Manager(client_key=self.client_id,
                          client_secret=self.client_secret,
                          resource_owner_key=key.access_token,
                          resource_owner_secret=key.secret,
                          signature_method=self.signature_method,
                          signature_type=self.signature_type)
     return self.session.request(method, url, auth=auth, params=params or {},
                                 data=data or {}, headers=headers or {},
                                 verify=self.verify, stream=True)