From 5e6361defc8c0f69076cefde800c4fc72c1263a5 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 15 Feb 2018 21:06:04 +0100 Subject: [PATCH 1/3] Set socket timeout to 10s --- pyrogram/connection/transport/tcp/tcp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyrogram/connection/transport/tcp/tcp.py b/pyrogram/connection/transport/tcp/tcp.py index 2ec899a7..a762a39e 100644 --- a/pyrogram/connection/transport/tcp/tcp.py +++ b/pyrogram/connection/transport/tcp/tcp.py @@ -30,6 +30,7 @@ Proxy = namedtuple("Proxy", ["enabled", "hostname", "port", "username", "passwor class TCP(socks.socksocket): def __init__(self, proxy: Proxy): super().__init__() + self.settimeout(10) self.proxy_enabled = False if proxy and proxy.enabled: From ad6cfcd165962b2bb293d45299e59e99a4159c0b Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 15 Feb 2018 21:06:25 +0100 Subject: [PATCH 2/3] Use PingDelayDisconnect instead --- pyrogram/session/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 8e56911f..c0410e3f 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -296,7 +296,7 @@ class Session: break try: - self._send(functions.Ping(0), False) + self._send(functions.PingDelayDisconnect(0, self.PING_INTERVAL + 15), False) except (OSError, TimeoutError): pass From a961eb88db115ca0516df935eef0f2a07e5ff221 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 15 Feb 2018 21:12:42 +0100 Subject: [PATCH 3/3] Update docstrings --- pyrogram/client/client.py | 2 +- pyrogram/client/input_media.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 8272714b..f5ac50ba 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -706,7 +706,7 @@ class Client: def resolve_peer(self, peer_id: int or str): """Use this method to get the *InputPeer* of a known *peer_id*. - It is intended to be used when working with Raw Functions (i.e: a Telegram API method you wish to use which is + It is intended to be used when working with Raw Functions (i.e: a Telegram API method you wish to use which is not available yet in the Client class as an easy-to-use method). Args: diff --git a/pyrogram/client/input_media.py b/pyrogram/client/input_media.py index 74da22b8..43a86019 100644 --- a/pyrogram/client/input_media.py +++ b/pyrogram/client/input_media.py @@ -20,10 +20,11 @@ class InputMedia: class Photo: """This object represents a photo to be sent inside an album. + It is intended to be used with :obj:`pyrogram.Client.send_media_group`. Args: media (:obj:`str`): - File to send. + Photo file to send. Pass a file path as string to send a photo that exists on your local machine. caption (:obj:`str`): @@ -45,10 +46,11 @@ class InputMedia: class Video: """This object represents a video to be sent inside an album. + It is intended to be used with :obj:`pyrogram.Client.send_media_group`. Args: media (:obj:`str`): - File to send. + Video file to send. Pass a file path as string to send a video that exists on your local machine. caption (:obj:`str`):