def create(self, consumer_key, consumer_secret, project):
     endpoint = utils.OAUTH_PATH + '/request_token'
     headers = {'requested_project_id': base.getid(project)}
     oauth_client = oauth1.Client(consumer_key,
                                  client_secret=consumer_secret,
                                  signature_method=oauth1.SIGNATURE_HMAC,
                                  callback_uri="oob")
     url = self.client.auth_url.rstrip("/") + endpoint
     url, headers, body = oauth_client.sign(url, http_method='POST',
                                            headers=headers)
     resp, body = self.client.post(endpoint, headers=headers)
     token = utils.get_oauth_token_from_body(resp.content)
     return self.resource_class(self, token)
示例#2
0
 def create(self, consumer_key, consumer_secret, request_key,
            request_secret, verifier):
     endpoint = utils.OAUTH_PATH + '/access_token'
     oauth_client = oauth1.Client(consumer_key,
                                  client_secret=consumer_secret,
                                  resource_owner_key=request_key,
                                  resource_owner_secret=request_secret,
                                  signature_method=oauth1.SIGNATURE_HMAC,
                                  verifier=verifier)
     url = self.client.auth_url.rstrip("/") + endpoint
     url, headers, body = oauth_client.sign(url, http_method='POST')
     resp, body = self.client.post(endpoint, headers=headers)
     token = utils.get_oauth_token_from_body(resp.content)
     return self.resource_class(self, token)
 def create(self, consumer_key, consumer_secret, project):
     endpoint = utils.OAUTH_PATH + '/request_token'
     headers = {'requested_project_id': base.getid(project)}
     oauth_client = oauth1.Client(consumer_key,
                                  client_secret=consumer_secret,
                                  signature_method=oauth1.SIGNATURE_HMAC,
                                  callback_uri="oob")
     url = self.client.auth_url.rstrip("/") + endpoint
     url, headers, body = oauth_client.sign(url,
                                            http_method='POST',
                                            headers=headers)
     resp, body = self.client.post(endpoint, headers=headers)
     token = utils.get_oauth_token_from_body(body)
     return self.resource_class(self, token)
 def create(self, consumer_key, consumer_secret, project):
     endpoint = utils.OAUTH_PATH + '/request_token'
     headers = {'requested-project-id': base.getid(project)}
     oauth_client = oauth1.Client(consumer_key,
                                  client_secret=consumer_secret,
                                  signature_method=oauth1.SIGNATURE_HMAC,
                                  callback_uri="oob")
     url = self.client.get_endpoint(interface=plugin.AUTH_INTERFACE).rstrip(
         "/")
     url, headers, body = oauth_client.sign(url + endpoint,
                                            http_method='POST',
                                            headers=headers)
     resp, body = self.client.post(endpoint, headers=headers)
     token = utils.get_oauth_token_from_body(resp.content)
     return self._prepare_return_value(resp,
                                       self.resource_class(self, token))
示例#5
0
 def create(self, consumer_key, consumer_secret, request_key,
            request_secret, verifier):
     endpoint = utils.OAUTH_PATH + '/access_token'
     oauth_client = oauth1.Client(consumer_key,
                                  client_secret=consumer_secret,
                                  resource_owner_key=request_key,
                                  resource_owner_secret=request_secret,
                                  signature_method=oauth1.SIGNATURE_HMAC,
                                  verifier=verifier)
     url = self.client.get_endpoint(
         interface=plugin.AUTH_INTERFACE).rstrip('/')
     url, headers, body = oauth_client.sign(url + endpoint,
                                            http_method='POST')
     resp, body = self.client.post(endpoint, headers=headers)
     token = utils.get_oauth_token_from_body(resp.content)
     return self._prepare_return_value(resp,
                                       self.resource_class(self, token))
 def create(self, consumer_key, consumer_secret, request_key,
            request_secret, verifier):
     endpoint = utils.OAUTH_PATH + '/access_token'
     oauth_client = oauth1.Client(consumer_key,
                                  client_secret=consumer_secret,
                                  resource_owner_key=request_key,
                                  resource_owner_secret=request_secret,
                                  signature_method=oauth1.SIGNATURE_HMAC,
                                  verifier=verifier)
     url = self.client.get_endpoint(interface=plugin.AUTH_INTERFACE).rstrip(
         '/')
     url, headers, body = oauth_client.sign(url + endpoint,
                                            http_method='POST')
     resp, body = self.client.post(endpoint, headers=headers)
     token = utils.get_oauth_token_from_body(resp.content)
     return self._prepare_return_value(resp,
                                       self.resource_class(self, token))