Skip to content

Commit

Permalink
Changed token request
Browse files Browse the repository at this point in the history
  • Loading branch information
vzagorovskiy committed Feb 26, 2023
1 parent a75e528 commit 0cb2fca
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.0] - 2023-02-26

### Changed

- Token request.


## [2.0.1] - 2023-02-25

### Changed
Expand Down
4 changes: 2 additions & 2 deletions aiotaipit/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '2.0.1'
__version_tuple__ = version_tuple = (2, 0, 1)
__version__ = version = '2.1.0'
__version_tuple__ = version_tuple = (2, 1, 0)
5 changes: 1 addition & 4 deletions aiotaipit/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,17 @@ async def _token_request(self, data: dict) -> dict:
LOGGER.debug("Token request %s with data %s",
_url, data)

async with self._session.post(_url, data=data) as resp:

async with self._session.get(_url, params=data) as resp:
if resp.status == 400:
error_info = await resp.json()
if error_info['error'] == 'invalid_grant':
raise TaipitAuthInvalidGrant(error_info['error_description'])
if error_info['error'] == 'invalid_client':
raise TaipitAuthInvalidClient(error_info['error_description'])
raise TaipitAuthError

resp.raise_for_status()

new_token = await resp.json()

if not self._is_valid_token(new_token):
raise TaipitInvalidTokenResponse

Expand Down

0 comments on commit 0cb2fca

Please sign in to comment.