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 return
elif packet._packet_type == packet._NOTIFY: elif packet._packet_type == packet._NOTIFY:
log.debug("%s:%i sent us a notification: %s", packet)
if packet.nt == SSDP_ROOT_DEVICE: if packet.nt == SSDP_ROOT_DEVICE:
address, port, path = ADDRESS_REGEX.findall(packet.location)[0] address, port, path = ADDRESS_REGEX.findall(packet.location)[0]
key = None key = None

View file

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