use running loop if possible

This commit is contained in:
Jack Robison 2018-10-08 17:44:11 -04:00
parent e6fbab30aa
commit 79fb296a6e
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -219,6 +219,9 @@ class UPnP:
kwargs: dict = None) -> None:
kwargs = kwargs or {}
try:
asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)