Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
client = smartcar.AuthClient(self.client_id, self.client_secret,
self.redirect_uri, self.scope, development=False)
actual = client.get_auth_url(force=True, state='stuff', single_select='potato')
query = urlencode({
'response_type': 'code',
'client_id': self.client_id,
'redirect_uri': self.redirect_uri,
'approval_prompt': 'force',
'state': 'stuff',
'scope': ' '.join(self.scope),
'single_select': False
})
expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query
expected_params = parse_qs(expected)
actual_params = parse_qs(actual)
assertDeepEquals(self, expected_params, actual_params)
def exchange_refresh_token(self, refresh_token):
""" Exchange a refresh token for a new access dictionary
Args:
refresh_token (str): A valid refresh token from a previously retrieved
access object
Returns:
dict: dict containing access and refresh token
Raises:
SmartcarException
"""
method = 'POST'
url = const.AUTH_URL
data = {
'grant_type': 'refresh_token',
'refresh_token': refresh_token
}
response = requester.call(method, url, data=data, auth=self.auth).json()
return set_expiration(response)