Skip to content

Commit 682591e

Browse files
committed
Update Auth and Session to accommodate Storage Engines
1 parent d472d06 commit 682591e

File tree

13 files changed

+36
-588
lines changed

13 files changed

+36
-588
lines changed

pyrogram/client/client.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626
import tempfile
2727
import threading
2828
import time
29-
import warnings
3029
from configparser import ConfigParser
3130
from hashlib import sha256, md5
3231
from importlib import import_module
3332
from pathlib import Path
3433
from signal import signal, SIGINT, SIGTERM, SIGABRT
3534
from threading import Thread
36-
from typing import Union, List, Type
35+
from typing import Union, List
3736

3837
from pyrogram.api import functions, types
3938
from pyrogram.api.core import TLObject
@@ -205,24 +204,9 @@ def __init__(
205204
no_updates: bool = None,
206205
takeout: bool = None
207206
):
207+
super().__init__()
208208

209-
if isinstance(session_name, str):
210-
if session_name == ':memory:':
211-
session_storage = MemorySessionStorage(self)
212-
elif session_name.startswith(':'):
213-
session_storage = StringSessionStorage(self, session_name)
214-
else:
215-
session_storage = SQLiteSessionStorage(self, session_name)
216-
elif isinstance(session_name, SessionStorage):
217-
session_storage = session_name
218-
else:
219-
raise RuntimeError('Wrong session_name passed, expected str or SessionConfig subclass')
220-
221-
super().__init__(session_storage)
222-
223-
super().__init__(session_storage)
224-
225-
self.session_name = str(session_name) # TODO: build correct session name
209+
self.session_name = session_name
226210
self.api_id = int(api_id) if api_id else None
227211
self.api_hash = api_hash
228212
self.app_version = app_version
@@ -232,7 +216,7 @@ def __init__(
232216
self.ipv6 = ipv6
233217
# TODO: Make code consistent, use underscore for private/protected fields
234218
self._proxy = proxy
235-
self.session_storage.test_mode = test_mode
219+
self.test_mode = test_mode
236220
self.bot_token = bot_token
237221
self.phone_number = phone_number
238222
self.phone_code = phone_code

pyrogram/client/ext/base_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from pyrogram import __version__
2828
from ..style import Markdown, HTML
2929
from ...session.internals import MsgId
30-
from ..session_storage import SessionStorage
3130

3231

3332
class BaseClient:

pyrogram/client/session_storage/abstract.py

Lines changed: 0 additions & 139 deletions
This file was deleted.

pyrogram/client/session_storage/json.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

pyrogram/client/session_storage/memory.py

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)