From 52c0fa961b8eea4b9a9d9b3ddab420b84c831bf0 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Tue, 20 Feb 2024 01:44:36 +0300 Subject: [PATCH] Add init_connection_params parameter to Client class --- pyrogram/client.py | 8 +++++++- pyrogram/session/session.py | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pyrogram/client.py b/pyrogram/client.py index ef1c099e..dbdb1136 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -189,6 +189,10 @@ class Client(Methods): storage_engine (:obj:`~pyrogram.storage.Storage`, *optional*): Pass an instance of your own implementation of session storage engine. Useful when you want to store your session in databases like Mongo, Redis, etc. + + init_connection_params (:obj:`~raw.base.JSONValue`, *optional*): + Additional initConnection parameters. + For now, only the tz_offset field is supported, for specifying timezone offset in seconds. """ APP_VERSION = f"Pyrogram {__version__}" @@ -242,7 +246,8 @@ class Client(Methods): sleep_threshold: int = Session.SLEEP_THRESHOLD, hide_password: bool = False, max_concurrent_transmissions: int = MAX_CONCURRENT_TRANSMISSIONS, - storage_engine: Storage = None + storage_engine: Storage = None, + init_connection_params: "raw.base.JSONValue" = None, ): super().__init__() @@ -273,6 +278,7 @@ class Client(Methods): self.sleep_threshold = sleep_threshold self.hide_password = hide_password self.max_concurrent_transmissions = max_concurrent_transmissions + self.init_connection_params = init_connection_params self.executor = ThreadPoolExecutor(self.workers, thread_name_prefix="Handler") diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index b2a93d2f..013ed295 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -129,6 +129,7 @@ class Session: lang_pack=self.client.lang_pack, lang_code=self.client.lang_code, query=raw.functions.help.GetConfig(), + params=self.client.init_connection_params, ) ), timeout=self.START_TIMEOUT