maxapi-python 0.1.0__py3-none-any.whl → 0.1.1__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.
- maxapi_python-0.1.1.dist-info/METADATA +147 -0
- maxapi_python-0.1.1.dist-info/RECORD +4 -0
- {maxapi_python-0.1.0.dist-info → maxapi_python-0.1.1.dist-info}/WHEEL +1 -2
- maxapi_python-0.1.0.dist-info/METADATA +0 -110
- maxapi_python-0.1.0.dist-info/RECORD +0 -12
- maxapi_python-0.1.0.dist-info/top_level.txt +0 -1
- pymax/__init__.py +0 -55
- pymax/core.py +0 -600
- pymax/crud.py +0 -99
- pymax/exceptions.py +0 -20
- pymax/models.py +0 -8
- pymax/static.py +0 -86
- pymax/types.py +0 -327
- {maxapi_python-0.1.0.dist-info → maxapi_python-0.1.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,147 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: maxapi-python
|
3
|
+
Version: 0.1.1
|
4
|
+
Summary: Python wrapper для API мессенджера Max
|
5
|
+
Project-URL: Homepage, https://github.com/noxzion/PyMax
|
6
|
+
Project-URL: Repository, https://github.com/noxzion/PyMax
|
7
|
+
Project-URL: Issues, https://github.com/noxzion/PyMax/issues
|
8
|
+
Author-email: noxzion <negroid2281488ilikrilex@gmail.com>
|
9
|
+
License-Expression: MIT
|
10
|
+
License-File: LICENSE
|
11
|
+
Keywords: api,max,messenger,websocket,wrapper
|
12
|
+
Classifier: Operating System :: OS Independent
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Requires-Python: >=3.10
|
15
|
+
Requires-Dist: sqlmodel>=0.0.24
|
16
|
+
Requires-Dist: websockets>=11.0
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
|
19
|
+
<p align="center">
|
20
|
+
<img src="assets/logo.svg" alt="PyMax" width="400">
|
21
|
+
</p>
|
22
|
+
|
23
|
+
<p align="center">
|
24
|
+
<strong>Python wrapper для API мессенджера Max</strong>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<p align="center">
|
28
|
+
<img src="https://img.shields.io/badge/python-3.10+-3776AB.svg" alt="Python 3.11+">
|
29
|
+
<img src="https://img.shields.io/badge/License-MIT-2f9872.svg" alt="License: MIT">
|
30
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
|
31
|
+
<img src="https://img.shields.io/badge/packaging-uv-D7FF64.svg" alt="Packaging">
|
32
|
+
</p>
|
33
|
+
|
34
|
+
---
|
35
|
+
|
36
|
+
## Описание
|
37
|
+
|
38
|
+
**`pymax`** — асинхронная Python библиотека для работы с API мессенджера Max. Предоставляет интерфейс для отправки сообщений, управления чатами, каналами и диалогами через WebSocket соединение.
|
39
|
+
|
40
|
+
### Основные возможности
|
41
|
+
|
42
|
+
- Вход по номеру телефона
|
43
|
+
- Отправка, редактирование и удаление сообщений
|
44
|
+
- Работа с чатами и каналами
|
45
|
+
- История сообщений
|
46
|
+
|
47
|
+
## Установка
|
48
|
+
|
49
|
+
> [!IMPORTANT]
|
50
|
+
> Для работы библиотеки требуется Python 3.10 или выше
|
51
|
+
|
52
|
+
### Установка через pip
|
53
|
+
|
54
|
+
```bash
|
55
|
+
pip install -U maxapi-python
|
56
|
+
```
|
57
|
+
|
58
|
+
### Установка через uv
|
59
|
+
|
60
|
+
```bash
|
61
|
+
uv add -U maxapi-python
|
62
|
+
```
|
63
|
+
|
64
|
+
## Быстрый старт
|
65
|
+
|
66
|
+
### Базовый пример использования
|
67
|
+
|
68
|
+
```python
|
69
|
+
import asyncio
|
70
|
+
from pymax import MaxClient, Message
|
71
|
+
|
72
|
+
# Инициализация клиента
|
73
|
+
phone = "+1234567890"
|
74
|
+
client = MaxClient(phone=phone, work_dir="cache")
|
75
|
+
|
76
|
+
# Обработчик входящих сообщений
|
77
|
+
@client.on_message
|
78
|
+
async def handle_message(message: Message) -> None:
|
79
|
+
print(f"{message.sender}: {message.text}")
|
80
|
+
|
81
|
+
# Обработчик запуска клиента
|
82
|
+
@client.on_start
|
83
|
+
async def handle_start() -> None:
|
84
|
+
print("Клиент запущен")
|
85
|
+
|
86
|
+
# Получение истории сообщений
|
87
|
+
history = await client.fetch_history(chat_id=0)
|
88
|
+
if history:
|
89
|
+
for message in history:
|
90
|
+
user = await client.get_user(message.sender)
|
91
|
+
if user:
|
92
|
+
print(f"{user.names[0].name}: {message.text}")
|
93
|
+
|
94
|
+
async def main() -> None:
|
95
|
+
await client.start()
|
96
|
+
|
97
|
+
# Работа с чатами
|
98
|
+
for chat in client.chats:
|
99
|
+
print(f"Чат: {chat.title}")
|
100
|
+
|
101
|
+
# Отправка сообщения
|
102
|
+
message = await client.send_message(
|
103
|
+
"Привет от PyMax!",
|
104
|
+
chat.id,
|
105
|
+
notify=True
|
106
|
+
)
|
107
|
+
|
108
|
+
# Редактирование сообщения
|
109
|
+
await asyncio.sleep(2)
|
110
|
+
await client.edit_message(
|
111
|
+
chat.id,
|
112
|
+
message.id,
|
113
|
+
"Привет от PyMax! (отредактировано)"
|
114
|
+
)
|
115
|
+
|
116
|
+
# Удаление сообщения
|
117
|
+
await asyncio.sleep(2)
|
118
|
+
await client.delete_message(chat.id, [message.id], for_me=False)
|
119
|
+
|
120
|
+
# Работа с диалогами
|
121
|
+
for dialog in client.dialogs:
|
122
|
+
print(f"Диалог: {dialog.last_message.text}")
|
123
|
+
|
124
|
+
# Работа с каналами
|
125
|
+
for channel in client.channels:
|
126
|
+
print(f"Канал: {channel.title}")
|
127
|
+
|
128
|
+
await client.close()
|
129
|
+
|
130
|
+
if __name__ == "__main__":
|
131
|
+
asyncio.run(main())
|
132
|
+
```
|
133
|
+
|
134
|
+
## Документация
|
135
|
+
|
136
|
+
WIP
|
137
|
+
|
138
|
+
## Лицензия
|
139
|
+
|
140
|
+
Этот проект распространяется под лицензией MIT. См. файл [LICENSE](LICENSE) для получения информации.
|
141
|
+
|
142
|
+
## Авторы
|
143
|
+
|
144
|
+
- **[noxzion](https://github.com/noxzion)** — оригинальный автор проекта
|
145
|
+
- **[ink](https://github.com/ink-developer)** — второй разработчик, исследование API и его документация
|
146
|
+
- **[fresh-milkshake](https://github.com/fresh-milkshake)** — контрибьютор и автор лого
|
147
|
+
|
@@ -0,0 +1,4 @@
|
|
1
|
+
maxapi_python-0.1.1.dist-info/METADATA,sha256=uHYKlxE6NA9cmATGtlE_AhF05iJarJmX4fKLCnuMbkE,4812
|
2
|
+
maxapi_python-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
3
|
+
maxapi_python-0.1.1.dist-info/licenses/LICENSE,sha256=Ud-0SKeXO_yA02Bb1nMDnEaSGwz2OqNlfGQbk0IzqPI,1085
|
4
|
+
maxapi_python-0.1.1.dist-info/RECORD,,
|
@@ -1,110 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: maxapi-python
|
3
|
-
Version: 0.1.0
|
4
|
-
Summary: Python wrapper для API мессенджера Max
|
5
|
-
Author-email: noxzion <negroid2281488ilikrilex@gmail.com>
|
6
|
-
License-Expression: MIT
|
7
|
-
Project-URL: Homepage, https://github.com/noxzion/PyMax
|
8
|
-
Project-URL: Repository, https://github.com/noxzion/PyMax
|
9
|
-
Project-URL: Issues, https://github.com/noxzion/PyMax/issues
|
10
|
-
Keywords: max,messenger,api,wrapper,websocket
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
12
|
-
Classifier: Operating System :: OS Independent
|
13
|
-
Requires-Python: >=3.11
|
14
|
-
Description-Content-Type: text/markdown
|
15
|
-
License-File: LICENSE
|
16
|
-
Requires-Dist: build>=1.3.0
|
17
|
-
Requires-Dist: pydocstring>=0.2.1
|
18
|
-
Requires-Dist: sqlmodel>=0.0.24
|
19
|
-
Requires-Dist: websockets>=11.0
|
20
|
-
Dynamic: license-file
|
21
|
-
|
22
|
-
## MApi - Python api wrapper для Max'a
|
23
|
-
|
24
|
-
## Установка
|
25
|
-
|
26
|
-
> [!IMPORTANT]
|
27
|
-
> Нужно иметь git для установки из репозитория
|
28
|
-
|
29
|
-
```bash
|
30
|
-
pip install git+https://github.com/noxzion/PyMax
|
31
|
-
```
|
32
|
-
|
33
|
-
Или (без git)
|
34
|
-
```bash
|
35
|
-
pip install maxapi-python
|
36
|
-
```
|
37
|
-
|
38
|
-
## Пример использования:
|
39
|
-
|
40
|
-
```python
|
41
|
-
import asyncio
|
42
|
-
|
43
|
-
from mapi import MaxClient, Message
|
44
|
-
|
45
|
-
|
46
|
-
phone = "+1234567890"
|
47
|
-
client = MaxClient(phone=phone, work_dir="cache")
|
48
|
-
|
49
|
-
|
50
|
-
async def main() -> None:
|
51
|
-
await client.start()
|
52
|
-
|
53
|
-
for chat in client.chats:
|
54
|
-
print(chat.title)
|
55
|
-
|
56
|
-
message = await client.send_message("Hello from MaxClient!", chat.id, notify=True)
|
57
|
-
|
58
|
-
await asyncio.sleep(5)
|
59
|
-
message = await client.edit_message(chat.id, message.id, "Hello from MaxClient! (edited)")
|
60
|
-
await asyncio.sleep(5)
|
61
|
-
|
62
|
-
await client.delete_message(chat.id, [message.id], for_me=False)
|
63
|
-
|
64
|
-
for dialog in client.dialogs:
|
65
|
-
print(dialog.last_message.text)
|
66
|
-
|
67
|
-
for channel in client.channels:
|
68
|
-
print(channel.title)
|
69
|
-
|
70
|
-
await client.close()
|
71
|
-
|
72
|
-
|
73
|
-
@client.on_message
|
74
|
-
async def handle_message(message: Message) -> None:
|
75
|
-
print(str(message.sender) + ": " + message.text)
|
76
|
-
|
77
|
-
|
78
|
-
@client.on_start
|
79
|
-
async def handle_start() -> None:
|
80
|
-
print("Client started successfully!")
|
81
|
-
history = await client.fetch_history(chat_id=0)
|
82
|
-
if history:
|
83
|
-
for message in history:
|
84
|
-
user_id = message.sender
|
85
|
-
user = await client.get_user(user_id)
|
86
|
-
|
87
|
-
if user:
|
88
|
-
print(f"{user.names[0].name}: {message.text}")
|
89
|
-
|
90
|
-
|
91
|
-
if __name__ == "__main__":
|
92
|
-
asyncio.run(client.start())
|
93
|
-
```
|
94
|
-
|
95
|
-
## Разработка
|
96
|
-
|
97
|
-
Сборка пакета:
|
98
|
-
|
99
|
-
```bash
|
100
|
-
python scripts/build.py
|
101
|
-
```
|
102
|
-
|
103
|
-
## Лицензия
|
104
|
-
|
105
|
-
[MIT](LICENSE)
|
106
|
-
|
107
|
-
## Авторы
|
108
|
-
|
109
|
-
- [noxzion](https://github.com/noxzion) - исходный код пакета
|
110
|
-
- [ink](https://github.com/ink-developer) - вскрытие API и документация
|
@@ -1,12 +0,0 @@
|
|
1
|
-
maxapi_python-0.1.0.dist-info/licenses/LICENSE,sha256=Ud-0SKeXO_yA02Bb1nMDnEaSGwz2OqNlfGQbk0IzqPI,1085
|
2
|
-
pymax/__init__.py,sha256=I-ZUVKBfHN-MPkLUbLPxflsvnHSFsyXdW3TmbN2_zz0,950
|
3
|
-
pymax/core.py,sha256=DI3yjlCvSipilWMescXluLbP-sDwoOD092K67dJqR38,25132
|
4
|
-
pymax/crud.py,sha256=Cn7Psw-gGN0607nqWOLlIorP_wowYWrLomlsof0gLkI,3311
|
5
|
-
pymax/exceptions.py,sha256=tiD_JD-MYSb4qFyKov-KWOm0zlD1p_gG6nf1fV-0-SY,702
|
6
|
-
pymax/models.py,sha256=7sWAmVuJjM7SPnDkpYEi8CARbTpUKbXqtWKMQdwd0w0,209
|
7
|
-
pymax/static.py,sha256=ZIPPAyr3__gtkwSgS_-hXk_oNkcVKs55tY8pSzOrSlY,1711
|
8
|
-
pymax/types.py,sha256=6EofkAY_oUnDkNh-cC9Uk05GjKgl6ThBy3_8Hjownz4,11541
|
9
|
-
maxapi_python-0.1.0.dist-info/METADATA,sha256=DOVISXKymoucnNKgU1z84wPCLA1Mcwx9rzpxBPAuKCQ,2808
|
10
|
-
maxapi_python-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
-
maxapi_python-0.1.0.dist-info/top_level.txt,sha256=bdAekZwlWiYDxQTWsAUa-yjplJDWDeWEmyhRO3R8qV4,6
|
12
|
-
maxapi_python-0.1.0.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
pymax
|
pymax/__init__.py
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Python wrapper для API мессенджера Max
|
3
|
-
"""
|
4
|
-
|
5
|
-
from .core import (
|
6
|
-
InvalidPhoneError,
|
7
|
-
MaxClient,
|
8
|
-
WebSocketNotConnectedError,
|
9
|
-
)
|
10
|
-
from .static import (
|
11
|
-
AccessType,
|
12
|
-
AuthType,
|
13
|
-
ChatType,
|
14
|
-
Constants,
|
15
|
-
DeviceType,
|
16
|
-
ElementType,
|
17
|
-
MessageStatus,
|
18
|
-
MessageType,
|
19
|
-
Opcode,
|
20
|
-
)
|
21
|
-
from .types import (
|
22
|
-
Channel,
|
23
|
-
Chat,
|
24
|
-
Dialog,
|
25
|
-
Element,
|
26
|
-
Message,
|
27
|
-
User,
|
28
|
-
)
|
29
|
-
|
30
|
-
__author__ = "noxzion"
|
31
|
-
|
32
|
-
__all__ = [
|
33
|
-
# Перечисления и константы
|
34
|
-
"AccessType",
|
35
|
-
"AuthType",
|
36
|
-
# Типы данных
|
37
|
-
"Channel",
|
38
|
-
"Chat",
|
39
|
-
"ChatType",
|
40
|
-
"Constants",
|
41
|
-
"DeviceType",
|
42
|
-
"Dialog",
|
43
|
-
"Element",
|
44
|
-
"ElementType",
|
45
|
-
# Исключения
|
46
|
-
"InvalidPhoneError",
|
47
|
-
# Клиент
|
48
|
-
"MaxClient",
|
49
|
-
"Message",
|
50
|
-
"MessageStatus",
|
51
|
-
"MessageType",
|
52
|
-
"Opcode",
|
53
|
-
"User",
|
54
|
-
"WebSocketNotConnectedError",
|
55
|
-
]
|