Skip to content

Commit

Permalink
Merge a847bee into 622b657
Browse files Browse the repository at this point in the history
  • Loading branch information
singingwolfboy committed Sep 11, 2014
2 parents 622b657 + a847bee commit 796a834
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
3 changes: 0 additions & 3 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ v0.4.2
- New ``authorized`` property on OAuth1Session and OAuth2Session, which allows
you to easily determine if the session is already authorized with OAuth tokens
or not.
- You can now pass a ``base_url`` parameter when creating a new OAuth1Session
or OAuth2Session. If you do, this value is prefixed to all HTTP requests
you make with this session.
- New ``TokenMissing`` and ``VerifierMissing`` exception classes for OAuth1Session:
this will make it easier to catch and identify these exceptions.

Expand Down
12 changes: 0 additions & 12 deletions requests_oauthlib/oauth1_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def __init__(self, client_key,
verifier=None,
client_class=None,
force_include_body=False,
base_url=None,
**kwargs):
"""Construct the OAuth 1 session.
Expand Down Expand Up @@ -151,8 +150,6 @@ def __init__(self, client_key,
`requests_oauthlib.OAuth1` instead of the default
:param force_include_body: Always include the request body in the
signature creation.
:param base_url: An optional string to use as a prefix for all requests
from this session.
:param **kwargs: Additional keyword arguments passed to `OAuth1`
"""
super(OAuth1Session, self).__init__()
Expand All @@ -169,7 +166,6 @@ def __init__(self, client_key,
force_include_body=force_include_body,
**kwargs)
self.auth = self._client
self.base_url = base_url

@property
def authorized(self):
Expand Down Expand Up @@ -373,11 +369,3 @@ def rebuild_auth(self, prepared_request, response):
prepared_request.headers.pop('Authorization', True)
prepared_request.prepare_auth(self.auth)
return

def prepare_request(self, request):
"""
If we have a `base_url`, prepend it to the URL.
"""
if self.base_url:
request.url = self.base_url + request.url
return super(OAuth1Session, self).prepare_request(request)
13 changes: 1 addition & 12 deletions requests_oauthlib/oauth2_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class OAuth2Session(requests.Session):

def __init__(self, client_id=None, client=None, auto_refresh_url=None,
auto_refresh_kwargs=None, scope=None, redirect_uri=None, token=None,
state=None, token_updater=None, base_url=None, **kwargs):
state=None, token_updater=None, **kwargs):
"""Construct a new OAuth 2 client session.
:param client_id: Client id obtained during registration
Expand All @@ -61,8 +61,6 @@ def __init__(self, client_id=None, client=None, auto_refresh_url=None,
set a TokenUpdated warning will be raised when a token
has been refreshed. This warning will carry the token
in its token argument.
:param base_url: An optional string to use as a prefix for all requests
from this session.
:param kwargs: Arguments to pass to the Session constructor.
"""
super(OAuth2Session, self).__init__(**kwargs)
Expand All @@ -77,7 +75,6 @@ def __init__(self, client_id=None, client=None, auto_refresh_url=None,
self.token_updater = token_updater
self._client = client or WebApplicationClient(client_id, token=token)
self._client._populate_attributes(token or {})
self.base_url = base_url

# Allow customizations for non compliant providers through various
# hooks to adjust requests and responses.
Expand Down Expand Up @@ -312,11 +309,3 @@ def register_compliance_hook(self, hook_type, hook):
raise ValueError('Hook type %s is not in %s.',
hook_type, self.compliance_hook)
self.compliance_hook[hook_type].add(hook)

def prepare_request(self, request):
"""
If we have a `base_url`, prepend it to the URL.
"""
if self.base_url:
request.url = self.base_url + request.url
return super(OAuth2Session, self).prepare_request(request)

0 comments on commit 796a834

Please sign in to comment.