Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

[Feature request] AsyncElasticsearch should implement an async context manager #48

Closed
@amandasystems

Description

@amandasystems

It would be nice if AsyncElasticsearch implemented the magic methods (specifically __aenter__() and __aexit__()) to become an async context manager, which would allow code like this:

async with AsyncElasticsearch() as client:
    print(await client.info()) 

and have the session closed.

Happy to implement this similar to how aiohttp has done it if you are interested!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions