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 return False
print('Unknown message: {}'.format(hex(code))) self._logger.warning('Unknown message: {}'.format(hex(code)))
return False return False
# endregion # endregion

View File

@ -142,7 +142,8 @@ class TelegramClient:
return True return True
except RPCError as error: except RPCError as error:
print('Could not stabilise initial connection: {}'.format(error)) self._logger.warning('Could not stabilise initial connection: {}'
.format(error))
return False return False
def _reconnect_to_dc(self, dc_id): def _reconnect_to_dc(self, dc_id):
@ -263,7 +264,6 @@ class TelegramClient:
except RPCError as error: except RPCError as error:
if error.message.startswith('PHONE_CODE_'): if error.message.startswith('PHONE_CODE_'):
print(error)
return False return False
else: else:
raise raise
@ -681,7 +681,8 @@ class TelegramClient:
file_path = '{} - {}'.format(attr.performer, attr.title) file_path = '{} - {}'.format(attr.performer, attr.title)
if file_path is None: 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: if add_extension:
file_path += get_extension(message_media_document) file_path += get_extension(message_media_document)