Bring back report_errors to the constructor

This commit is contained in:
Lonami Exo 2018-03-15 10:22:21 +01:00
parent 3b42bc9991
commit 1e3120b0b6
3 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,5 @@
.. _api-status:
========== ==========
API Status API Status
========== ==========

View File

@ -73,6 +73,7 @@ class TelegramBareClient:
update_workers=None, update_workers=None,
spawn_read_thread=False, spawn_read_thread=False,
timeout=timedelta(seconds=5), timeout=timedelta(seconds=5),
report_errors=True,
device_model=None, device_model=None,
system_version=None, system_version=None,
app_version=None, app_version=None,
@ -103,6 +104,7 @@ class TelegramBareClient:
DEFAULT_PORT DEFAULT_PORT
) )
session.report_errors = report_errors
self.session = session self.session = session
self.api_id = int(api_id) self.api_id = int(api_id)
self.api_hash = api_hash self.api_hash = api_hash

View File

@ -146,8 +146,12 @@ class TelegramClient(TelegramBareClient):
instantly, as soon as they arrive. Can still be disabled instantly, as soon as they arrive. Can still be disabled
if you want to run the library without any additional thread. if you want to run the library without any additional thread.
report_errors (:obj:`bool`, optional):
Whether to report RPC errors or not. Defaults to ``True``,
see :ref:`api-status` for more information.
Kwargs: Kwargs:
Some extra parameters are required when stabilishing the first Some extra parameters are required when establishing the first
connection. These are are (along with their default values): connection. These are are (along with their default values):
.. code-block:: python .. code-block:: python
@ -168,6 +172,7 @@ class TelegramClient(TelegramBareClient):
update_workers=None, update_workers=None,
timeout=timedelta(seconds=5), timeout=timedelta(seconds=5),
spawn_read_thread=True, spawn_read_thread=True,
report_errors=True,
**kwargs): **kwargs):
super().__init__( super().__init__(
session, api_id, api_hash, session, api_id, api_hash,
@ -177,6 +182,7 @@ class TelegramClient(TelegramBareClient):
update_workers=update_workers, update_workers=update_workers,
spawn_read_thread=spawn_read_thread, spawn_read_thread=spawn_read_thread,
timeout=timeout, timeout=timeout,
report_errors=report_errors,
**kwargs **kwargs
) )