From 1b48f850bf570847a7e2e26e03faf3a04362e631 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Tue, 1 May 2018 20:25:35 +0200 Subject: [PATCH] Add new sessions to the media_sessions dict before starting them --- pyrogram/client/client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index feeea853..ae8bf87f 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -2992,6 +2992,8 @@ class Client: self.api_id ) + self.media_sessions[dc_id] = session + session.start() session.send( @@ -3009,9 +3011,9 @@ class Client: self.api_id ) - session.start() + self.media_sessions[dc_id] = session - self.media_sessions[dc_id] = session + session.start() if volume_id: # Photos are accessed by volume_id, local_id, secret location = types.InputFileLocation( @@ -3080,10 +3082,10 @@ class Client: is_cdn=True ) - cdn_session.start() - self.media_sessions[r.dc_id] = cdn_session + cdn_session.start() + try: with tempfile.NamedTemporaryFile("wb", delete=False) as f: file_name = f.name