Skip to content

Commit 445bb19

Browse files
James Byrnefguillot
authored andcommitted
Fix async get_event_loop call when not in main thread
1 parent a565345 commit 445bb19

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

kanboard.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self,
5757
password,
5858
auth_header=DEFAULT_AUTH_HEADER,
5959
cafile=None,
60-
loop=asyncio.get_event_loop()):
60+
loop=None):
6161
"""
6262
Constructor
6363
@@ -74,7 +74,12 @@ def __init__(self,
7474
self._password = password
7575
self._auth_header = auth_header
7676
self._cafile = cafile
77-
self._event_loop = loop
77+
78+
if not loop:
79+
try:
80+
self._event_loop = asyncio.get_event_loop()
81+
except RuntimeError:
82+
self._event_loop = asyncio.new_event_loop()
7883

7984
def __getattr__(self, name):
8085
if self.is_async_method_name(name):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def readme():
3030

3131
setup(
3232
name='kanboard',
33-
version='1.1.1',
33+
version='1.1.2',
3434
description='Client library for Kanboard API',
3535
long_description=readme(),
3636
keywords='kanboard api client',

0 commit comments

Comments
 (0)