Skip to content

Commit

Permalink
[ADD] support context manager on Client
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Salamea authored and mvantellingen committed Nov 3, 2022
1 parent 9c5a016 commit c87acd1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/zeep/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ def _get_service(self, name: typing.Optional[str]) -> str:
service = next(iter(self.wsdl.services.values()), None)
return service

def __enter__(self):
return self

def __exit__(self, exc_type=None, exc_value=None, traceback=None):
self.transport.close()


class AsyncClient(Client):
_default_transport = AsyncTransport
Expand Down

0 comments on commit c87acd1

Please sign in to comment.