Commit c25403a3 authored by Adirio's avatar Adirio

Turn Client into a context manager

Allows using client as a context manager for the with statement:

with Client(URL) as client:
    client.do_something()
parent 52223d88
......@@ -98,6 +98,13 @@ class Client(object):
self._session_counter = 1
self.keepalive = None
def __enter__(self):
self.connect()
return self
def __exit__(self):
self.disconnect()
@staticmethod
def find_endpoint(endpoints, security_mode, policy_uri):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment