def refresh(self): api_request = ApiRequest(self._api) api_request.method('POST') api_request.url('token/refresh') api_request.action('token/refresh') api_request.set('refreshToken', self._refresh_token) tokens = api_request.execute('Token refresh failure.') self._access_token = tokens['accessToken']
def refresh(self): if not self._refresh_token: raise TokenError('Can\'t refresh token without "refresh_token"') api_request = ApiRequest(self._api) api_request.method('POST') api_request.url('token/refresh') api_request.action('token/refresh') api_request.set('refreshToken', self._refresh_token) tokens = api_request.execute('Token refresh failure.') self._access_token = tokens['accessToken']
def _tokens(self): api_request = ApiRequest(self._api) api_request.method('POST') api_request.url('token') api_request.action('token') api_request.set('login', self._login) api_request.set('password', self._password) tokens = api_request.execute('Login failure.') self._refresh_token = tokens['refreshToken'] self._access_token = tokens['accessToken']