maxuserapi 0.1.0__tar.gz → 0.1.1__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.
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.idea/vcs.xml +1 -1
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.idea/workspace.xml +18 -15
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/PKG-INFO +2 -2
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/client.py +14 -2
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/pyproject.toml +2 -2
- maxuserapi-0.1.1/session.sessionToken +2 -0
- maxuserapi-0.1.1/tests.py +19 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.idea/.gitignore +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.idea/MaxAPI.iml +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.idea/inspectionProfiles/Project_Default.xml +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.idea/misc.xml +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.idea/modules.xml +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/.pypirc +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/LICENSE +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/README.md +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/__init__.py +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/enums/__init__.py +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/enums/opcodes.py +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/handlers/__init__.py +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/handlers/handler.py +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/handlers/message_handler.py +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/requesting.py +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/types/__init__.py +0 -0
- {maxuserapi-0.1.0 → maxuserapi-0.1.1}/maxuserapi/types/message.py +0 -0
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
7
|
<list default="true" id="a3f8aa14-c555-40e6-80d3-c0f84ee59f35" name="Changes" comment="">
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/maxuserapi/LICENSE" beforeDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/maxuserapi/client.py" beforeDir="false" afterPath="$PROJECT_DIR$/maxuserapi/client.py" afterDir="false" />
|
|
9
10
|
</list>
|
|
10
11
|
<option name="SHOW_DIALOG" value="false" />
|
|
11
12
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -13,23 +14,23 @@
|
|
|
13
14
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
14
15
|
</component>
|
|
15
16
|
<component name="Git.Settings">
|
|
16
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/
|
|
17
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/maxuserapi" />
|
|
17
18
|
</component>
|
|
18
|
-
<component name="GitHubPullRequestSearchHistory"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
<component name="GitHubPullRequestSearchHistory">{
|
|
20
|
+
"lastFilter": {
|
|
21
|
+
"state": "OPEN",
|
|
22
|
+
"assignee": "ReoGentO"
|
|
22
23
|
}
|
|
23
|
-
}
|
|
24
|
-
<component name="GithubPullRequestsUISettings"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
}</component>
|
|
25
|
+
<component name="GithubPullRequestsUISettings">{
|
|
26
|
+
"selectedUrlAndAccountId": {
|
|
27
|
+
"url": "https://github.com/ReoGentO/MaxUserAPI",
|
|
28
|
+
"accountId": "74a2decd-8485-4533-8fb8-6a4614d1b142"
|
|
28
29
|
}
|
|
29
|
-
}
|
|
30
|
-
<component name="ProjectColorInfo"
|
|
31
|
-
|
|
32
|
-
}
|
|
30
|
+
}</component>
|
|
31
|
+
<component name="ProjectColorInfo">{
|
|
32
|
+
"associatedIndex": 7
|
|
33
|
+
}</component>
|
|
33
34
|
<component name="ProjectId" id="3Dz3fFblEa364o2TjjMgjub8pjS" />
|
|
34
35
|
<component name="ProjectViewState">
|
|
35
36
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
@@ -37,7 +38,9 @@
|
|
|
37
38
|
</component>
|
|
38
39
|
<component name="PropertiesComponent"><![CDATA[{
|
|
39
40
|
"keyToString": {
|
|
41
|
+
"Python.tests.executor": "Run",
|
|
40
42
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
43
|
+
"RunOnceActivity.git.unshallow": "true",
|
|
41
44
|
"git-widget-placeholder": "master",
|
|
42
45
|
"last_opened_file_path": "A:/PythonProjects/MaxAPI"
|
|
43
46
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: maxuserapi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Библиотека для работы с MAX USER API
|
|
5
|
-
Project-URL: Homepage, https://github.com/ReoGenT/
|
|
5
|
+
Project-URL: Homepage, https://github.com/ReoGenT/MaxUserAPI
|
|
6
6
|
Author: ReoGenT
|
|
7
7
|
License-Expression: Apache-2.0
|
|
8
8
|
License-File: LICENSE
|
|
@@ -42,7 +42,6 @@ class Client:
|
|
|
42
42
|
self.__handshake["payload"]["deviceId"] = str(uuid.uuid4())
|
|
43
43
|
self.favourite = 0
|
|
44
44
|
self.ws = None
|
|
45
|
-
self.loop = asyncio.get_event_loop()
|
|
46
45
|
|
|
47
46
|
self._keepalive_task: asyncio.Task = None
|
|
48
47
|
|
|
@@ -223,6 +222,8 @@ class Client:
|
|
|
223
222
|
while True:
|
|
224
223
|
try:
|
|
225
224
|
await self.__listen()
|
|
225
|
+
except (asyncio.CancelledError, KeyboardInterrupt):
|
|
226
|
+
break
|
|
226
227
|
except websockets.ConnectionClosed as e:
|
|
227
228
|
print(f"[!] Соединение закрыто ({e}), переподключение через 3с...")
|
|
228
229
|
await asyncio.sleep(3)
|
|
@@ -230,7 +231,10 @@ class Client:
|
|
|
230
231
|
print(f"[!] Ошибка: {e}, повтор через 5с...")
|
|
231
232
|
await asyncio.sleep(5)
|
|
232
233
|
|
|
233
|
-
|
|
234
|
+
try:
|
|
235
|
+
asyncio.run(_run_loop())
|
|
236
|
+
except KeyboardInterrupt:
|
|
237
|
+
pass
|
|
234
238
|
|
|
235
239
|
async def start(self):
|
|
236
240
|
"""Метод для запуска внутри уже существующего цикла событий"""
|
|
@@ -244,6 +248,14 @@ class Client:
|
|
|
244
248
|
async def stop(self):
|
|
245
249
|
print("[*] Закрытие соединений MaxAPI...")
|
|
246
250
|
|
|
251
|
+
if self._keepalive_task and not self._keepalive_task.done():
|
|
252
|
+
self._keepalive_task.cancel()
|
|
253
|
+
try:
|
|
254
|
+
await self._keepalive_task
|
|
255
|
+
except asyncio.CancelledError:
|
|
256
|
+
pass
|
|
257
|
+
print("[+] Keepalive остановлен")
|
|
258
|
+
|
|
247
259
|
# 1. Закрываем WebSocket
|
|
248
260
|
if self.ws:
|
|
249
261
|
try:
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "maxuserapi"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.1"
|
|
8
8
|
description = "Библиотека для работы с MAX USER API"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.7"
|
|
@@ -19,4 +19,4 @@ dependencies = [
|
|
|
19
19
|
]
|
|
20
20
|
|
|
21
21
|
[project.urls]
|
|
22
|
-
Homepage = "https://github.com/ReoGenT/
|
|
22
|
+
Homepage = "https://github.com/ReoGenT/MaxUserAPI"
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sessionToken=An_Sx6HQ9HDiER4VJ_t7NhBGIBe_GihpYOFJgq0GlBhea1Jw84tmjfObBWv_hGG9tyxsj4gFTzMpW1_APVk0QR5CAqEwJ6pUpzvQz-iaYMcCN6jcxJkDJ4Sop1vfFBc_swPy3i6MW9JVFQj6lYIesWX8Th9q5SDFY-2oEWM8Cm4l982MFaWrauA3b0TbPeMcSnN0O8A63Khi3X_5DMODnmNf3XSs3Dp_jCYWDSUlPP2Unmb_MXhhw_9EYGQBFeQmqqnECCF8tU_yUO4YWtKxm8Yz6uB0EbPIy6U4QMmOXc1hfBZnShX-qhC7_0Mte2iJHRlUCP79aTdFUc-4tCDJINJFxNG7weVA8ZQLQFssCH95bA4VNUtM33yygUYuwh-HJfrPgOS4_6fwQOtu3wqtAoUqoJv181H4ObIpt9YNHuB7FgHuwRhJ5VUQrKfWrvGvMMQiozDiuOwFHBBR8YzjzRmWNlHB_m06giuHwVSfWH4X-aAAF630XM6PPL1XhnWI9ZhhqdXUjGHNYtJroAEfgWEeDPY2HkvoRNKIOC013Cm4MEoztA6FVwUts4QnJI_nSh4zBpLK_D4q_hSNDNiHVWhPFmuJV4Cd3ZcNleuv9ldEUJZp65LXn6gQN3ow2qnGpZFGqy-oLMQ1V88I6B-PNa3s9UeN_jhYVZvrTMIV9on8bkAnSozRTX0K9B7UCHGQQOJ0vJQ
|
|
2
|
+
deviceId=ec1dce54-25ff-4b0a-ae46-0cc3e6fa9fb8
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import asyncio
|
|
3
|
+
|
|
4
|
+
if sys.platform == 'win32':
|
|
5
|
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
6
|
+
|
|
7
|
+
from maxuserapi import Client
|
|
8
|
+
|
|
9
|
+
app = Client("session")
|
|
10
|
+
|
|
11
|
+
@app.on_message(chat_id=app.favourite, text_filter="Привет")
|
|
12
|
+
async def handle_message(client, message):
|
|
13
|
+
await message.reply("Привет! Это ответ от бота.")
|
|
14
|
+
|
|
15
|
+
if __name__ == "__main__":
|
|
16
|
+
try:
|
|
17
|
+
app.run()
|
|
18
|
+
except KeyboardInterrupt:
|
|
19
|
+
print("\n[+] Скрипт успешно остановлен пользователем.")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|