|
49 | 49 | ) |
50 | 50 | from hydrogram.handlers.handler import Handler |
51 | 51 | from hydrogram.methods import Methods |
| 52 | +from hydrogram.methods.messages.inline_session import get_session |
52 | 53 | from hydrogram.session import Auth, Session |
53 | 54 | from hydrogram.storage import BaseStorage, SQLiteStorage |
54 | 55 | from hydrogram.types import ListenerTypes, TermsOfService, User |
@@ -930,30 +931,8 @@ async def get_file( |
930 | 931 |
|
931 | 932 | dc_id = file_id.dc_id |
932 | 933 |
|
933 | | - session = Session( |
934 | | - self, |
935 | | - dc_id, |
936 | | - await Auth(self, dc_id, await self.storage.test_mode()).create() |
937 | | - if dc_id != await self.storage.dc_id() |
938 | | - else await self.storage.auth_key(), |
939 | | - await self.storage.test_mode(), |
940 | | - is_media=True, |
941 | | - ) |
942 | | - |
943 | 934 | try: |
944 | | - await session.start() |
945 | | - |
946 | | - if dc_id != await self.storage.dc_id(): |
947 | | - exported_auth = await self.invoke( |
948 | | - raw.functions.auth.ExportAuthorization(dc_id=dc_id) |
949 | | - ) |
950 | | - |
951 | | - await session.invoke( |
952 | | - raw.functions.auth.ImportAuthorization( |
953 | | - id=exported_auth.id, bytes=exported_auth.bytes |
954 | | - ) |
955 | | - ) |
956 | | - |
| 935 | + session = await get_session(self, dc_id) |
957 | 936 | r = await session.invoke( |
958 | 937 | raw.functions.upload.GetFile( |
959 | 938 | location=location, offset=offset_bytes, limit=chunk_size |
|
0 commit comments