-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added async client | AUTH-9219 | [DO Not Merge] #37
base: master
Are you sure you want to change the base?
Conversation
b9de2b2
to
793938c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer not to maintain both sync/async versions of the individual clients.
So now that we have async connector/platform clients, we can delete sync versions and add sync wrapper functionality to the regular (sync) client class.
(loop = asyncio.get_event_loop()
, loop. run_until_complete(
/loop. ensure_future(
)
def __init__(self, auth_token: str, base_url: str = AUTHOMIZE_API_URL): | ||
self.auth_token = auth_token | ||
self.base_url = base_url | ||
self.session = aiohttp.ClientSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it awaitable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.... the session doesn't needs to be awaited.
raise NotImplementedError() | ||
|
||
async def http_get(self, url, params=None): | ||
url = self.base_url + url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use furl for URL construction.
response.raise_for_status() | ||
|
||
async def http_post(self, url: str, body: Optional[str] = None): | ||
url = self.base_url + url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use furl for URL construction.
response.raise_for_status() | ||
|
||
async def http_delete(self, url: str, params=None): | ||
url = self.base_url + url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use furl for URL construction.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
🎫 https://authomize.atlassian.net/browse/AUTH-9219