Fix TelegramClient.sign_in not accepting an integer for the code

This commit is contained in:
Lonami Exo 2017-08-24 18:05:32 +02:00
parent 4384ccb132
commit b7dbf9767e
2 changed files with 4 additions and 1 deletions

View File

@ -281,8 +281,11 @@ class TelegramClient(TelegramBareClient):
'Please make sure to call send_code_request first.')
try:
if isinstance(code, int):
code = str(code)
result = self(SignInRequest(
phone_number, self._phone_code_hashes[phone_number], code))
phone_number, self._phone_code_hashes[phone_number], code
))
except (PhoneCodeEmptyError, PhoneCodeExpiredError,
PhoneCodeHashEmptyError, PhoneCodeInvalidError):