ecthiender / py-graphql-client

Dead-simple GraphQL client with subscriptions over websockets
https://pypi.org/project/py-graphql-client/
Other
37 stars 11 forks source link

support for context manager or `with` statement #21

Closed ecthiender closed 4 years ago

ecthiender commented 4 years ago

Support GraphQLClient to be used with a context manage a.k.a with statement.

E.g -

with GraphQLClient('ws://localhost:8080/graphql') as client:
    sub_id = client.subscribe(..)
    ...
    client.stop_subscribe(sub_id)