maxapi-python 1.1.17__py3-none-any.whl → 1.1.18__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maxapi-python
3
- Version: 1.1.17
3
+ Version: 1.1.18
4
4
  Summary: Python wrapper для API мессенджера Max
5
5
  Project-URL: Homepage, https://github.com/ink-developer/PyMax
6
6
  Project-URL: Repository, https://github.com/ink-developer/PyMax
@@ -1,5 +1,5 @@
1
1
  pymax/__init__.py,sha256=6wUKKwsyxFpWG3b7kwptOvHd-w78C-ygw42iCDBYQvc,1915
2
- pymax/core.py,sha256=uSmIYVBqiO-3v0wtehObnvOEJ3n_dpG62TXTKwmdFf4,13838
2
+ pymax/core.py,sha256=Ee5R9GfhjDhSjAd2skKsG7Sp5h7AkvN0gtEWXWL7wVE,14189
3
3
  pymax/crud.py,sha256=wmJh8MPi3L_HbYp7MJP0eXfDcnjgfkLDa9rHAmXtkow,3219
4
4
  pymax/exceptions.py,sha256=nDUNx7bM-Yjugj-qfIllcrnwLg9JpZroYqfXapjYbMQ,3178
5
5
  pymax/files.py,sha256=dRuOpvoJZWiH4xa_HVGyqQ-_Zzj-sVikElHmrPjwgs0,3166
@@ -9,7 +9,7 @@ pymax/formatting.py,sha256=hhtmakfcQDzQRsAckPunnJOCKY2lFdLeIp8Yw53yY8s,2522
9
9
  pymax/interfaces.py,sha256=WWKNGT725GXuYneS9gCOAC6RNtySRs-BTU0fQLyh2OQ,3399
10
10
  pymax/models.py,sha256=PsPGbOkERxesZZltjNrmqhOfRcO44Is2ThbEToREcB8,201
11
11
  pymax/navigation.py,sha256=4ia6RGY2pXMArboNhHkbWlWX7LtcYK1VGVXorPX0Pb4,5747
12
- pymax/payloads.py,sha256=qaafULDGBXsQ7gNFC374wZVUwN5tzJLHwkxtAmglOzU,6292
12
+ pymax/payloads.py,sha256=S1dJwDPanFfIdY_NlXN2epVyibmmL9bceltgLVmEtTA,6304
13
13
  pymax/types.py,sha256=RaLn9bUpkxO0SKbDMIHnoFeqV6gqOl2pKDNCa2LxTRI,32102
14
14
  pymax/mixins/__init__.py,sha256=xvjcq-lFVHCPss_t8xxXya0OJnsh-owlBqtUlrXSCcw,695
15
15
  pymax/mixins/auth.py,sha256=H4Zp3n8cwpv4Q3Mn1_Kb7Oh9DbTL7T9GcWJ6R1JN7ls,6672
@@ -25,7 +25,7 @@ pymax/mixins/utils.py,sha256=s3FUf3i_wjn2Gbg5YY1rWZB-90ZEGrrcUuND_MqqSTE,853
25
25
  pymax/mixins/websocket.py,sha256=LaL-okzhJCyS3uWV7xsCCKnuff_rooKjAoZ8vkaintY,16817
26
26
  pymax/static/constant.py,sha256=Q1NrmaRj17Gdhk3FmUp3HIwrad1TDorq3wFdQlOCzN8,1027
27
27
  pymax/static/enum.py,sha256=c_QaLU0Ephe4SuKFIpwpmrf_HCutc34JJ6o4Ik1E6_g,4582
28
- maxapi_python-1.1.17.dist-info/METADATA,sha256=0gplAk5x9ujWD7fkCZu_yvwataKPPq3fMETJbwHb3HQ,6245
29
- maxapi_python-1.1.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- maxapi_python-1.1.17.dist-info/licenses/LICENSE,sha256=hOR249ItqMdcly1A0amqEWRNRTq4Gv5NJtmQ3A5qK4E,1070
31
- maxapi_python-1.1.17.dist-info/RECORD,,
28
+ maxapi_python-1.1.18.dist-info/METADATA,sha256=XJlvDWCpM0QCT1HgbNgevis67UmNW8dp91ED3s9J2Wg,6245
29
+ maxapi_python-1.1.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
+ maxapi_python-1.1.18.dist-info/licenses/LICENSE,sha256=hOR249ItqMdcly1A0amqEWRNRTq4Gv5NJtmQ3A5qK4E,1070
31
+ maxapi_python-1.1.18.dist-info/RECORD,,
pymax/core.py CHANGED
@@ -7,7 +7,7 @@ import time
7
7
  import traceback
8
8
  from collections.abc import Awaitable
9
9
  from pathlib import Path
10
- from typing import TYPE_CHECKING, Any, Literal
10
+ from typing import TYPE_CHECKING, Any, Literal, Self
11
11
 
12
12
  from typing_extensions import override
13
13
 
@@ -329,6 +329,18 @@ class MaxClient(ApiMixin, WebSocketMixin):
329
329
  self.logger.info("Reconnect enabled — restarting client")
330
330
  await asyncio.sleep(self.reconnect_delay)
331
331
 
332
+ async def idle(self):
333
+ await asyncio.Event().wait()
334
+
335
+ async def __aenter__(self) -> Self:
336
+ self._create_safe_task(self.start(), name="start")
337
+ while not self.is_connected:
338
+ await asyncio.sleep(0.05)
339
+ return self
340
+
341
+ async def __aexit__(self, exc_type, exc, tb) -> None:
342
+ await self.close()
343
+
332
344
 
333
345
  class SocketMaxClient(SocketMixin, MaxClient):
334
346
  @override
pymax/payloads.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Any, Final, Literal
1
+ from typing import Any, Literal
2
2
 
3
3
  from pydantic import AliasChoices, BaseModel, Field
4
4
 
@@ -30,7 +30,7 @@ class CamelModel(BaseModel):
30
30
 
31
31
 
32
32
  class BaseWebSocketMessage(BaseModel):
33
- ver: Final[int] = 11
33
+ ver: Literal[10, 11] = 11
34
34
  cmd: int
35
35
  seq: int
36
36
  opcode: int
@@ -195,14 +195,14 @@ class ChangeGroupProfilePayload(CamelModel):
195
195
 
196
196
 
197
197
  class GetGroupMembersPayload(CamelModel):
198
- type: Final[str] = "MEMBER"
198
+ type: Literal["MEMBER"] = "MEMBER"
199
199
  marker: int
200
200
  chat_id: int
201
201
  count: int
202
202
 
203
203
 
204
204
  class SearchGroupMembersPayload(CamelModel):
205
- type: Final[str] = "MEMBER"
205
+ type: Literal["MEMBER"] = "MEMBER"
206
206
  query: str
207
207
  chat_id: int
208
208