From 2ad02e4759d554690b832180e37903160650d9f9 Mon Sep 17 00:00:00 2001 From: lanf0n Date: Tue, 10 Dec 2019 00:52:23 +0800 Subject: [PATCH 1/2] Deferred ClientSession() initialization --- aioflowdock/flowdock.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aioflowdock/flowdock.py b/aioflowdock/flowdock.py index 17fb474..c75d8bc 100644 --- a/aioflowdock/flowdock.py +++ b/aioflowdock/flowdock.py @@ -16,10 +16,16 @@ def __init__(self, email, password="", url="", session=None, loop=None): super().__init__(loop or get_event_loop()) self.email = email self.password = password - self.session = session or ClientSession() + self._session = session self.url = url or environ.get("FLOWDOCK_API_URL", DEFAULT_URL) secret = ("%s:%s" % (email, password)).encode() self.auth = "Basic " + b64encode(secret).decode() + + @property + def session(self): + if self._session is None: + self._session = ClientSession() + return self._session def stream(self, flows, options=None): options = options or dict() From 277f6d0dcdbb58ea060d059a6bebba6902858358 Mon Sep 17 00:00:00 2001 From: lanf0n Date: Tue, 10 Dec 2019 17:11:08 +0800 Subject: [PATCH 2/2] bump to 0.2.2 --- aioflowdock/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aioflowdock/__init__.py b/aioflowdock/__init__.py index dd8c8cf..cf3910e 100644 --- a/aioflowdock/__init__.py +++ b/aioflowdock/__init__.py @@ -1,5 +1,5 @@ from .flowdock import Session from .stream import EventStream -__version__ = '0.2.1' +__version__ = '0.2.2' __all__ = ["Session", "EventStream"]