Return the request token for this API. If we've not fetched it yet,
        go out, request and memoize it.
10379
def get_request_token(self):
        
        
        if self._request_token is None:
            self._request_token = self._get_request_token()
        return self._request_token
7708
def _get_token(self, oauth_request, token_type='access'):
        """"""
        token_field = oauth_request.get_parameter('oauth_token')
        token = self.data_store.lookup_token(token_type, token_field)
        if not token:
            raise OAuthError('Invalid %s token: %s' % (token_type, token_field))
        return token
1207516
def get_requester(self):
        
        # TODO(abrahms): Perhaps pull this out into a factory function for
        # generating an EdxApi instance with the proper requester & credentials.
        session = requests.session()
        session.headers.update({
            'Authorization': 'Bearer {}'.format(self.credentials['access_token'])
        })

        old_request = session.request

        def patched_request(*args, **kwargs):
            """
            adds timeout param to session.request
            """
            return old_request(*args, timeout=self.timeout, **kwargs)

        session.request = patched_request
        return session
668233
def retrieve_token(self, token):
        
        headers = self.client._get_private_headers()
        endpoint = '/tokens/{}'.format(token)
        return self.client._get(self.client.URL_BASE + endpoint, headers=headers)
1195957
def get_token
      return @token if !@token.nil?
      body =  build_auth_json

      http_client = HTTPClient.new

      p @auth_url
      p body
	
      response = http_client.post_content(@auth_url, body, 'Content-Type' => 'application/json')
      response_json_body = JSON.load(response)

      @token = response_json_body['access']['token']['id']
    end
548039
def _get_request(self, request_url, request_method, **params):
        
        if request_method == 'GET':
            if params:
                request_url += '&%s' % urlencode(params)
            request = Request(request_url)
        elif request_method == 'POST':
            request = Request(request_url, urlencode(params, doseq=1))
        return request
540019
def token(self):
        
        if not self._token:
            self._token = self.fetch_token()
            logger.payment(self)
        return self._token
1373643
def get_token(self, code, headers=None, **kwargs):
        
        self._check_configuration("site", "token_url", "redirect_uri",
                                  "client_id", "client_secret")
        url = "%s%s" % (self.site, quote(self.token_url))
        data = {
            'redirect_uri': self.redirect_uri,
            'client_id': self.client_id,
            'client_secret': self.client_secret,
            'code': code,
        }
        data.update(kwargs)

        return self._make_request(url, data=data, headers=headers)
64539
def get_request_token(params = {})
      params[:oauth_callback] = params.delete(:callback_url)
      response = client.get_request_token(params)
      RequestToken.new(response[:oauth_token], response[:oauth_token_secret])
    end
1155681
def access_token(self):
        """"""
        if self.cache_token:
            return self.access_token_ or \
                   self._resolve_credential('access_token')
        return self.access_token_
534990
def _refresh(self):
        
        # Request and set a new API token.
        new_token = self.authenticate(self._username, self._password)
        self._token = new_token
        logger.info('New API token received: "{}".'.format(new_token))
        return self._token
3063
def fetch_request_token(self, oauth_request):
        
        try:
            # Get the request token for authorization.
            token = self._get_token(oauth_request, 'request')
        except Error:
            # No token required for the initial token request.
            version = self._get_version(oauth_request)
            consumer = self._get_consumer(oauth_request)
            try:
                callback = self.get_callback(oauth_request)
            except Error:
                callback = None # 1.0, no callback specified.
            self._check_signature(oauth_request, consumer, None)
            # Fetch a new token.
            token = self.data_store.fetch_request_token(consumer, callback)
        return token
718406
def get_token(self, url):
        
        # A hack to avoid url-encoding the url, since the authorization service
        # doesn't work with correctly encoded urls

        parsed_url = urlparse.urlsplit(url)
        parsed_url = parsed_url._replace(path='/authorization/api')
        self.url = urlparse.urlunsplit(parsed_url)

        response = self.request(method='GET', url='/v1/token?url=' + url)
        return response.result.text
244256
def get_token(self, request):
        
        return stripe.Token.create(
            card={
                "number": request.data["number"],
                "exp_month": request.data["exp_month"],
                "exp_year": request.data["exp_year"],
                "cvc": request.data["cvc"]

            }
        )
433565
def _request(self, method, identifier, key=None, value=None):
        """"""
        params = {'id': identifier}
        if key is not None and value is not None:
            params[key] = value
        result = yield from self._transact(method, params)
        return result.get(key)
529195
def _get_oauth_token(self):
        
        url = urljoin(self.api_url, '/oauth2/token')

        oauth = OAuth2Session(
            client_id=self._client_id,
            redirect_uri=config.REDIRECT_URI,
        )

        token = oauth.fetch_token(
            token_url=url,
            code=self._auth_code,
            client_secret=self._client_secret,
        )

        return token
247297
def request_token(self):
        
        client_key = request.oauth.client_key
        realm = request.oauth.realm
        # TODO: fallback on default realm?
        callback = request.oauth.callback_uri
        request_token = generate_token(length=self.request_token_length[1])
        token_secret = generate_token(length=self.secret_length)
        self.save_request_token(client_key, request_token, callback,
            realm=realm, secret=token_secret)
        return urlencode([(u'oauth_token', request_token),
                          (u'oauth_token_secret', token_secret),
                          (u'oauth_callback_confirmed', u'true')])