From c97640b054c14c0d02739fdfa2564cd85f8216ea Mon Sep 17 00:00:00 2001 From: betaboon Date: Wed, 17 Mar 2021 15:59:53 +0100 Subject: [PATCH] aiocoap monkeypatch: attempt at making it work --- aioairctrl/coap/aiocoap_monkeypatch.py | 14 ++++++++------ setup.py | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/aioairctrl/coap/aiocoap_monkeypatch.py b/aioairctrl/coap/aiocoap_monkeypatch.py index 48a92ff..54a0b60 100644 --- a/aioairctrl/coap/aiocoap_monkeypatch.py +++ b/aioairctrl/coap/aiocoap_monkeypatch.py @@ -1,8 +1,7 @@ import asyncio import functools -import aiocoap -from aiocoap import error +from aiocoap.messagemanager import MessageManager from aiocoap.numbers.constants import EXCHANGE_LIFETIME @@ -14,7 +13,10 @@ def _deduplicate_message(self, message): return False -aiocoap.messagemanager.MessageManager._deduplicate_message = _deduplicate_message +MessageManager._deduplicate_message = _deduplicate_message + +from aiocoap.protocol import ClientObservation +from aiocoap.error import ObservationCancelled, NotObservable, LibraryShutdown def __del__(self): @@ -23,14 +25,14 @@ def __del__(self): # Fetch the result so any errors show up at least in the # finalizer output self._future.result() - except (error.ObservationCancelled, error.NotObservable): + except (ObservationCancelled, NotObservable): # This is the case at the end of an observation cancelled # by the server. pass - except error.LibraryShutdown: + except LibraryShutdown: pass except asyncio.CancelledError: pass -aiocoap.protocol.ClientObservation._Iterator.__del__ = __del__ +ClientObservation._Iterator.__del__ = __del__ diff --git a/setup.py b/setup.py index 015b405..41f468a 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ setup( name="aioairctrl", + version="0.2.1", description="library for controlling philips air purifiers (using encrypted CoAP)", author="betaboon", url="https://github.com/betaboon/aioairctrl",