Skip to content

Commit

Permalink
Merge c5c7bf3 into 08727f0
Browse files Browse the repository at this point in the history
  • Loading branch information
kasajei committed Sep 23, 2014
2 parents 08727f0 + c5c7bf3 commit d2b748f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions requests_oauthlib/oauth1_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def authorization_url(self, url, request_token=None, **kwargs):
log.debug('Adding parameters %s to url %s', kwargs, url)
return add_params_to_uri(url, kwargs.items())

def fetch_request_token(self, url, realm=None):
def fetch_request_token(self, url, realm=None, request_data=None):
"""Fetch a request token.
This is the first step in the OAuth 1 workflow. A request token is
Expand All @@ -243,6 +243,7 @@ def fetch_request_token(self, url, realm=None):
:param url: The request token endpoint URL.
:param realm: A list of realms to request access to.
:param request_data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:returns: The response in dict format.
Note that a previously set callback_uri will be reset for your
Expand All @@ -258,7 +259,7 @@ def fetch_request_token(self, url, realm=None):
}
"""
self._client.client.realm = ' '.join(realm) if realm else None
token = self._fetch_token(url)
token = self._fetch_token(url, request_data)
log.debug('Resetting callback_uri and realm (not needed in next phase).')
self._client.client.callback_uri = None
self._client.client.realm = None
Expand Down Expand Up @@ -335,9 +336,9 @@ def _populate_attributes(self, token):
if 'oauth_verifier' in token:
self._client.client.verifier = token['oauth_verifier']

def _fetch_token(self, url):
def _fetch_token(self, url, request_data=None):
log.debug('Fetching token from %s using client %s', url, self._client.client)
r = self.post(url)
r = self.post(url, request_data)

if r.status_code >= 400:
error = "Token request failed with code %s, response was '%s'."
Expand Down

0 comments on commit d2b748f

Please sign in to comment.