Skip to content
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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

aashishAuthomized
Copy link
Member

Copy link
Member

@RoiAuthomize RoiAuthomize left a 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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it awaitable?

Copy link
Member Author

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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.

@sonarcloud
Copy link

sonarcloud bot commented Mar 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

No Coverage information No Coverage information
2.1% 2.1% Duplication

@aashishAuthomized aashishAuthomized changed the title Added async client | AUTH-9219 Added async client | AUTH-9219 | [DO Not Merge] Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants