in uber_rides/auth.py [0:0]
def get_session(self, redirect_url):
"""Create Session to store credentials.
Parameters
redirect_url (str)
The full URL that the Uber server redirected to after
the user authorized your app.
Returns
(Session)
A Session object with OAuth 2.0 credentials.
Raises
UberIllegalState (APIError)
Raised if redirect URL contains an error.
"""
query_params = self._extract_query(redirect_url)
error = query_params.get('error')
if error:
raise UberIllegalState(error)
# convert space delimited string to set
scopes = query_params.get('scope')
scopes_set = {scope for scope in scopes.split()}
oauth2credential = OAuth2Credential(
client_id=self.client_id,
redirect_url=self.redirect_url,
access_token=query_params.get('access_token'),
expires_in_seconds=query_params.get('expires_in'),
scopes=scopes_set,
grant_type=auth.IMPLICIT_GRANT,
)
return Session(oauth2credential=oauth2credential)