-
Notifications
You must be signed in to change notification settings - Fork 44
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
Implement __aenter__ and __aexit__ in Client class for use with context manager #121
Comments
Great work! This was something that the creator wanted to add. Did you run all the examples with this update? |
Thanks! I've only tried with basic scripts, but it should work with almost anything as it uses the class own init() and http.close() methods |
If you create a pr, we can test and merge it! |
Thank you for the suggestion. Context manager is now available in v2.2.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This simple workaround is already enough to work with asynchronous context managers:
It can be easily implemented into the official code for easier use of the Client class, without the need to close after using it (also making it more organized):
versus:
The text was updated successfully, but these errors were encountered: