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

Add async support #46

Merged
merged 1 commit into from
Mar 8, 2020
Merged

Add async support #46

merged 1 commit into from
Mar 8, 2020

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Mar 3, 2020

This adds support for working with the august api with async

The existing non-async support is left in-tact and it now shares
a common base module for Api and Authenticator to ensure
backwards compat.

When using async, the following changes need to be made in your
code

Api is now ApiAsync

ApiAsync must be passed an aiohttp ClientSession()
as the first argument

await async_setup() must be called to setup the object
after creating it

Authenticator is now AuthenticatorAsync

AuthenticatorAsync must be passed an aiohttp ClientSession()
as the first argument

await async_setup_authentication() must be called to setup
the object

AugustApiHTTPError is replaced with AugustApiAIOHTTPError

Checking for RequestException is replaced with checking for
ClientError

All of the async functions are prefixed with async_
Ex get_operable_locks is now async_get_operable_locks

This adds support for working with the august api with async

The existing non-async support is left in-tact and it now shares
a common base module for Api and Authenticator to ensure
backwards compat.

When using async, the following changes need to be made in your
code

Api is now ApiAsync

  ApiAsync must be passed an aiohttp ClientSession()
  as the first argument

  await async_setup() must be called to setup the object
  after creating it

Authenticator is now AuthenticatorAsync

  AuthenticatorAsync must be passed an aiohttp ClientSession()
  as the first argument

  await async_setup_authentication() must be called to setup
  the object

AugustApiHTTPError is replaced with AugustApiAIOHTTPError

Checking for RequestException is replaced with checking for
ClientError

All of the async functions are prefixed with async_
Ex get_operable_locks is now async_get_operable_locks
@snjoetw snjoetw merged commit dee8716 into snjoetw:master Mar 8, 2020
@snjoetw
Copy link
Owner

snjoetw commented Mar 8, 2020

Awesome work!

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.

2 participants