Allow overriding phone on .sign_in (fix #278)

This commit is contained in:
Lonami Exo 2017-10-01 11:31:26 +02:00
parent 1d159908c7
commit 1d250a5441

View File

@ -148,9 +148,12 @@ class TelegramClient(TelegramBareClient):
if phone and not code: if phone and not code:
return self.send_code_request(phone) return self.send_code_request(phone)
elif code: elif code:
if self._phone is None: if not self._phone:
self._phone = phone
if not self._phone:
raise ValueError( raise ValueError(
'Please make sure to call send_code_request first.') 'Please make sure to call send_code_request first.'
)
try: try:
if isinstance(code, int): if isinstance(code, int):