pyrogram-client 0.0.6__tar.gz → 0.0.7.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. {pyrogram_client-0.0.6/pyrogram_client.egg-info → pyrogram_client-0.0.7.dev2}/PKG-INFO +1 -1
  2. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/base.py +2 -1
  3. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/bot.py +2 -4
  4. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/user.py +6 -7
  5. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/loader.py +8 -0
  6. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2/pyrogram_client.egg-info}/PKG-INFO +1 -1
  7. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/.env.sample +0 -0
  8. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/.gitignore +0 -0
  9. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/.pre-commit-config.yaml +0 -0
  10. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/makefile +0 -0
  11. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyproject.toml +0 -0
  12. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/dc.json +0 -0
  13. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/client/file.py +0 -0
  14. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyro_client/storage.py +0 -0
  15. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/SOURCES.txt +0 -0
  16. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/dependency_links.txt +0 -0
  17. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/requires.txt +0 -0
  18. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/pyrogram_client.egg-info/top_level.txt +0 -0
  19. {pyrogram_client-0.0.6 → pyrogram_client-0.0.7.dev2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyrogram-client
3
- Version: 0.0.6
3
+ Version: 0.0.7.dev2
4
4
  Author-email: Mike Artemiev <mixartemev@gmail.com>
5
5
  Project-URL: Homepage, https://gitlab.com/XyncNet/pyro-client
6
6
  Project-URL: Repository, https://gitlab.com/XyncNet/pyro-client
@@ -48,10 +48,11 @@ class BaseClient(Client):
48
48
  if not self.is_connected:
49
49
  await self.preload()
50
50
  try:
51
- await super().start(use_qr=use_qr, except_ids=except_ids or [])
51
+ return await super().start(use_qr=use_qr, except_ids=except_ids or [])
52
52
  except (AuthKeyUnregistered, Unauthorized) as e:
53
53
  await self.storage.session.delete()
54
54
  raise e
55
+ return self
55
56
 
56
57
  async def send(
57
58
  self,
@@ -21,12 +21,10 @@ class BotClient(BaseClient):
21
21
 
22
22
 
23
23
  async def main():
24
- from x_auth import models
25
24
  from x_model import init_db
25
+ from pyro_client.loader import TORM
26
26
 
27
- from pyro_client.loader import PG_DSN
28
-
29
- _ = await init_db(PG_DSN, models, True)
27
+ _ = await init_db(TORM, True)
30
28
 
31
29
  bc: BotClient = BotClient(6806432376)
32
30
  bc1: BotClient = BotClient(TOKEN)
@@ -84,7 +84,7 @@ class UserClient(BaseClient):
84
84
  return v
85
85
  return 2
86
86
 
87
- async def authorize(self, sent_code: SentCode = None) -> User:
87
+ async def authorize(self, sent_code: SentCode = None) -> User | None:
88
88
  sent_code_desc = {
89
89
  enums.SentCodeType.APP: "Telegram app",
90
90
  enums.SentCodeType.SMS: "SMS",
@@ -134,8 +134,8 @@ class UserClient(BaseClient):
134
134
  except BadRequest as e:
135
135
  await self.send(e.MESSAGE)
136
136
  self.password = None
137
- else:
138
- raise Exception("User does not sent code")
137
+ else:
138
+ raise Exception("User does not sent code")
139
139
  if isinstance(signed_in, User):
140
140
  await self.send("✅")
141
141
  await self.storage.save()
@@ -143,6 +143,7 @@ class UserClient(BaseClient):
143
143
 
144
144
  if not signed_in:
145
145
  await self.receive("No registered such phone number")
146
+ return None
146
147
 
147
148
  async def session_update(self, dc: int):
148
149
  await self.session.stop()
@@ -164,12 +165,10 @@ class UserClient(BaseClient):
164
165
 
165
166
 
166
167
  async def main():
167
- from x_auth import models
168
168
  from x_model import init_db
169
+ from pyro_client.loader import TORM
169
170
 
170
- from pyro_client.loader import PG_DSN
171
-
172
- _ = await init_db(PG_DSN, models, True)
171
+ _ = await init_db(TORM, True)
173
172
 
174
173
  logging.basicConfig(level=logging.INFO)
175
174
 
@@ -1,11 +1,19 @@
1
1
  from dotenv import load_dotenv
2
2
  from os import getenv as env
3
3
 
4
+ from x_auth import models
5
+
4
6
  load_dotenv()
5
7
 
6
8
  API_ID = env("API_ID")
7
9
  API_HASH = env("API_HASH")
8
10
  PG_DSN = f"postgres://{env('POSTGRES_USER')}:{env('POSTGRES_PASSWORD')}@{env('POSTGRES_HOST', 'xyncdbs')}:" \
9
11
  f"{env('POSTGRES_PORT', 5432)}/{env('POSTGRES_DB', env('POSTGRES_USER'))}"
12
+ TORM = {
13
+ "connections": {"default": PG_DSN},
14
+ "apps": {"models": {"models": [models]}},
15
+ "use_tz": False,
16
+ "timezone": "UTC",
17
+ }
10
18
  TOKEN = env("TOKEN")
11
19
  WSToken = env("WST")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyrogram-client
3
- Version: 0.0.6
3
+ Version: 0.0.7.dev2
4
4
  Author-email: Mike Artemiev <mixartemev@gmail.com>
5
5
  Project-URL: Homepage, https://gitlab.com/XyncNet/pyro-client
6
6
  Project-URL: Repository, https://gitlab.com/XyncNet/pyro-client