Replace library print()'s with calls to _logger

This commit is contained in:
Lonami Exo 2017-05-30 10:24:08 +02:00
parent fb4885aed0
commit 0b9d76bda1
2 changed files with 5 additions and 4 deletions

View File

@ -246,7 +246,7 @@ class MtProtoSender:
return False
print('Unknown message: {}'.format(hex(code)))
self._logger.warning('Unknown message: {}'.format(hex(code)))
return False
# endregion

View File

@ -142,7 +142,8 @@ class TelegramClient:
return True
except RPCError as error:
print('Could not stabilise initial connection: {}'.format(error))
self._logger.warning('Could not stabilise initial connection: {}'
.format(error))
return False
def _reconnect_to_dc(self, dc_id):
@ -263,7 +264,6 @@ class TelegramClient:
except RPCError as error:
if error.message.startswith('PHONE_CODE_'):
print(error)
return False
else:
raise
@ -681,7 +681,8 @@ class TelegramClient:
file_path = '{} - {}'.format(attr.performer, attr.title)
if file_path is None:
print('Could not determine a filename for the document')
raise ValueError('Could not infer a file_path for the document'
'. Please provide a valid file_path manually')
if add_extension:
file_path += get_extension(message_media_document)