Skip to content

Commit 2ab3257

Browse files
committed
Raise a RuntimeError if update_token is True but email and or password is not set
1 parent 51ab98a commit 2ab3257

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

coc/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ class Client:
111111
112112
"""
113113

114-
def __init__(self, token, *, loop=None, email, password, update_tokens=False):
115-
self.loop = loop if loop is not None else asyncio.get_event_loop()
114+
def __init__(self, token, *, loop=None, email=None, password=None, update_tokens=False):
115+
self.loop = self.loop = loop or asyncio.get_event_loop()
116+
117+
if update_tokens is True and (not email) or (not password):
118+
raise RuntimeError('An email and password must be set if update_tokens is True')
119+
116120
self.http = HTTPClient(token=token, loop=self.loop, email=email,
117121
password=password, update_tokens=update_tokens)
118122
log.info('Clash of Clans API client created')

0 commit comments

Comments
 (0)