fix cli arg types

This commit is contained in:
Jack Robison 2018-10-10 14:05:35 -04:00
parent 7257947700
commit 040faedbf9
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 3 additions and 1 deletions

View file

@ -82,6 +82,7 @@ class SSDPProtocol(MulticastProtocol):
return
elif packet._packet_type == packet._NOTIFY:
log.debug("%s:%i sent us a notification: %s", packet)
if packet.nt == SSDP_ROOT_DEVICE:
address, port, path = ADDRESS_REGEX.findall(packet.location)[0]
key = None

View file

@ -219,6 +219,7 @@ class UPnP:
service: str = '', man: str = '', interface_name: str = 'default',
kwargs: dict = None) -> None:
kwargs = kwargs or {}
timeout = int(timeout)
try:
asyncio.get_running_loop()
except RuntimeError:
@ -246,7 +247,7 @@ class UPnP:
fut.set_exception(UPnPError("\"%s\" is not a recognized command" % method))
return
try:
result = await fn(**kwargs)
result = await fn(**{k: fn.__annotations__[k](v) for k, v in kwargs.items()})
fut.set_result(result)
except UPnPError as err:
fut.set_exception(err)