Skip to content

Commit

Permalink
aiocoap monkeypatch: attempt at making it work
Browse files Browse the repository at this point in the history
  • Loading branch information
betaboon committed Mar 17, 2021
1 parent ecadd31 commit c97640b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions aioairctrl/coap/aiocoap_monkeypatch.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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):
Expand All @@ -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__
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c97640b

Please sign in to comment.