arizona-forum-api-async 1.1.3__py3-none-any.whl → 1.3__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.
- {arizona_forum_api_async-1.1.3.dist-info → arizona_forum_api_async-1.3.dist-info}/METADATA +2 -3
- {arizona_forum_api_async-1.1.3.dist-info → arizona_forum_api_async-1.3.dist-info}/RECORD +7 -7
- arizona_forum_async/api.py +60 -14
- arizona_forum_async/models/member_object.py +3 -2
- arizona_forum_async/models/thread_object.py +6 -0
- {arizona_forum_api_async-1.1.3.dist-info → arizona_forum_api_async-1.3.dist-info}/WHEEL +0 -0
- {arizona_forum_api_async-1.1.3.dist-info → arizona_forum_api_async-1.3.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: arizona-forum-api-async
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.3
|
4
4
|
Summary: Асинхронная Python библиотека для взаимодействия с форумом Arizona RP (forum.arizona-rp.com) без необходимости получения API ключа.
|
5
5
|
Home-page: https://github.com/fakelag28/Arizona-Forum-API-Async
|
6
6
|
Author: fakelag28
|
@@ -77,8 +77,7 @@ pip install arizona-forum-api-async
|
|
77
77
|
|
78
78
|
## Документация и примеры
|
79
79
|
|
80
|
-
* **[
|
81
|
-
* **[Документация оригинальной библиотеки](https://tastybread123.github.io/Arizona-API/arz_api.html):** Документация для оригинальной синхронной библиотеки.
|
80
|
+
* **[Официальная документация](https://docs.fakelag.tech/arz_forum_api/general-info):** Полное руководство по использованию асинхронной версии API.
|
82
81
|
* **[Папка с примерами](https://github.com/fakelag28/Arizona-Forum-API-Async/tree/main/examples):** Практические примеры, демонстрирующие различные возможности библиотеки.
|
83
82
|
|
84
83
|
---
|
@@ -1,16 +1,16 @@
|
|
1
1
|
arizona_forum_async/__init__.py,sha256=LJfbSfw1rC8SKOl5AON1KYPnuKA8CamlgEaNRbMybI4,68
|
2
|
-
arizona_forum_async/api.py,sha256=
|
2
|
+
arizona_forum_async/api.py,sha256=cC_4hTGxDML5tNg4HhXf3eFKw0OV9617j4mjiSUgajs,97364
|
3
3
|
arizona_forum_async/consts.py,sha256=AlYiIL9Z5t_HvZfaPKfQc72yg6cbl_VHvEs3GYIo3JU,527
|
4
4
|
arizona_forum_async/exceptions.py,sha256=mcWTrRgl1m5ljMYK2-WlNXWnnKSzI5K7fd_EYxJ6-eo,563
|
5
5
|
arizona_forum_async/bypass_antibot/__init__.py,sha256=8FaH5DlQ4acb-sjj-CUYmLsm1Y2zrB2zPVWayybokGo,21
|
6
6
|
arizona_forum_async/bypass_antibot/script.py,sha256=vlIkzhWHJOL5hX8YY5hdcI7q9TReNsZJYSEiecq7H0U,35300
|
7
7
|
arizona_forum_async/models/__init__.py,sha256=Oz9cUlLgRC2Wbqd79bE9ffiHjxRIwE_Zguf4t9dDDyE,112
|
8
8
|
arizona_forum_async/models/category_object.py,sha256=6quTtKSOyROK87MKCmrMyBxiMJv65weB0JAxYg95E10,4832
|
9
|
-
arizona_forum_async/models/member_object.py,sha256=
|
9
|
+
arizona_forum_async/models/member_object.py,sha256=chMgucg_MiMfb5NCs0pDYTgdAd6MWGdN1uQyu6Iz7eM,5012
|
10
10
|
arizona_forum_async/models/other.py,sha256=hC9Hg749RRSULUpZ_l_cT5VwpsrG1MOFGZ8MyP3nuCc,536
|
11
11
|
arizona_forum_async/models/post_object.py,sha256=eJ3YrO1QbYtpCcErV1jfRfGFuXNmpXYwaIZT0h5sjVM,6097
|
12
|
-
arizona_forum_async/models/thread_object.py,sha256=
|
13
|
-
arizona_forum_api_async-1.
|
14
|
-
arizona_forum_api_async-1.
|
15
|
-
arizona_forum_api_async-1.
|
16
|
-
arizona_forum_api_async-1.
|
12
|
+
arizona_forum_async/models/thread_object.py,sha256=UznL50cSdmMW8v69iWDwUFVd33010JJg0Bg4vIbQtBY,5959
|
13
|
+
arizona_forum_api_async-1.3.dist-info/METADATA,sha256=soG3Sto83cYOJyjFwoNn2kRM_fy2tbsmHP_Bq7x6adk,4834
|
14
|
+
arizona_forum_api_async-1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
arizona_forum_api_async-1.3.dist-info/top_level.txt,sha256=a9GRkw-bNV0GUAHWG7S7n5lGQvBuNu6dfXWF5WqEw6A,20
|
16
|
+
arizona_forum_api_async-1.3.dist-info/RECORD,,
|
arizona_forum_async/api.py
CHANGED
@@ -101,7 +101,7 @@ class ArizonaAPI:
|
|
101
101
|
raise Exception(f"Не удалось получить информацию для пользователя с ID {user_id}")
|
102
102
|
|
103
103
|
return CurrentMember(self, user_id, member_info.username, member_info.user_title,
|
104
|
-
member_info.avatar, member_info.roles, member_info.messages_count,
|
104
|
+
member_info.avatar, member_info.roles, member_info.activity, member_info.messages_count,
|
105
105
|
member_info.reactions_count, member_info.trophies_count, member_info.username_color)
|
106
106
|
except aiohttp.ClientError as e:
|
107
107
|
print(f"Ошибка сети при получении данных текущего пользователя: {e}")
|
@@ -149,7 +149,7 @@ class ArizonaAPI:
|
|
149
149
|
try:
|
150
150
|
async with self._session.get(url, params=params) as response:
|
151
151
|
if response.status == 403:
|
152
|
-
return Member(self, user_id, None, None, None, [], 0, 0, 0, '#fff')
|
152
|
+
return Member(self, user_id, None, None, None, None, [], 0, 0, 0, '#fff')
|
153
153
|
response.raise_for_status()
|
154
154
|
data = await response.json()
|
155
155
|
|
@@ -160,6 +160,8 @@ class ArizonaAPI:
|
|
160
160
|
soup = BeautifulSoup(html_content, 'lxml')
|
161
161
|
username = unescape(data['html']['title'])
|
162
162
|
|
163
|
+
activity = soup.find('dd', {'dir': 'auto'}).get_text(strip=False).strip('\n')
|
164
|
+
|
163
165
|
username_class = soup.find('span', class_='username')
|
164
166
|
username_color = '#fff'
|
165
167
|
if username_class:
|
@@ -207,11 +209,11 @@ class ArizonaAPI:
|
|
207
209
|
if trophy_tag: trophies_count = int(trophy_tag.text.strip().replace(',', ''))
|
208
210
|
except (AttributeError, ValueError): pass
|
209
211
|
|
210
|
-
return Member(self, user_id, username, user_title, avatar, roles, messages_count, reactions_count, trophies_count, username_color)
|
212
|
+
return Member(self, user_id, username, user_title, avatar, roles, activity, messages_count, reactions_count, trophies_count, username_color)
|
211
213
|
|
212
214
|
except aiohttp.ClientResponseError as e:
|
213
215
|
if e.status == 403:
|
214
|
-
return Member(self, user_id, None, None, None, [], 0, 0, 0, '#fff')
|
216
|
+
return Member(self, user_id, None, None, None, None, [], 0, 0, 0, '#fff')
|
215
217
|
print(f"Ошибка сети при получении пользователя {user_id}: {e}")
|
216
218
|
return None
|
217
219
|
except aiohttp.ClientError as e:
|
@@ -259,19 +261,25 @@ class ArizonaAPI:
|
|
259
261
|
except Exception as e:
|
260
262
|
print(f"Ошибка получения создателя ({creator_id}) для темы {thread_id}: {e}")
|
261
263
|
if not creator:
|
262
|
-
creator = Member(self, creator_id, creator_tag.text, None, None, None, None, None, None, None)
|
264
|
+
creator = Member(self, creator_id, creator_tag.text, None, None, None, None, None, None, None, None)
|
263
265
|
else:
|
264
266
|
print(f"Не удалось найти информацию о создателе для темы {thread_id}")
|
265
267
|
return None
|
266
268
|
|
267
269
|
|
268
270
|
create_date_tag = content_soup.find('time')
|
269
|
-
create_date =
|
271
|
+
create_date = 0
|
272
|
+
if create_date_tag and create_date_tag.has_attr('data-time'):
|
273
|
+
data_time_value = create_date_tag['data-time']
|
274
|
+
if data_time_value.isdigit():
|
275
|
+
create_date = int(data_time_value)
|
276
|
+
else:
|
277
|
+
create_date = 0
|
270
278
|
|
271
279
|
prefix_tag = content_h1_soup.find('span', {'class': 'label'})
|
272
280
|
if prefix_tag:
|
273
281
|
prefix = prefix_tag.text
|
274
|
-
title = content_h1_soup.text.strip(prefix).strip()
|
282
|
+
title = content_h1_soup.text.strip().replace(prefix, "").strip()
|
275
283
|
else:
|
276
284
|
prefix = ""
|
277
285
|
title = content_h1_soup.text.strip()
|
@@ -321,9 +329,9 @@ class ArizonaAPI:
|
|
321
329
|
try:
|
322
330
|
creator = await self.get_member(creator_id)
|
323
331
|
except Exception as e:
|
324
|
-
creator = Member(self, creator_id, None, None, None, None, None, None, None, None)
|
332
|
+
creator = Member(self, creator_id, None, None, None, None, None, None, None, None, None)
|
325
333
|
if not creator:
|
326
|
-
creator = Member(self, creator_id, creator_info_tag.text, None, None, None, None, None, None, None)
|
334
|
+
creator = Member(self, creator_id, creator_info_tag.text, None, None, None, None, None, None, None, None)
|
327
335
|
else:
|
328
336
|
return None
|
329
337
|
|
@@ -340,7 +348,13 @@ class ArizonaAPI:
|
|
340
348
|
return None
|
341
349
|
|
342
350
|
create_date_tag = post_article.find('time', {'class': 'u-dt'})
|
343
|
-
create_date =
|
351
|
+
create_date = 0
|
352
|
+
if create_date_tag and create_date_tag.has_attr('data-time'):
|
353
|
+
data_time_value = create_date_tag['data-time']
|
354
|
+
if data_time_value.isdigit():
|
355
|
+
create_date = int(data_time_value)
|
356
|
+
else:
|
357
|
+
create_date = 0
|
344
358
|
|
345
359
|
html_content_tag = post_article.find('div', {'class': 'bbWrapper'})
|
346
360
|
html_content = str(html_content_tag) if html_content_tag else ""
|
@@ -377,7 +391,7 @@ class ArizonaAPI:
|
|
377
391
|
try:
|
378
392
|
creator = await self.get_member(creator_id)
|
379
393
|
except Exception as e:
|
380
|
-
creator = Member(self, creator_id, None, None, None, [], 0, 0, 0, '#fff')
|
394
|
+
creator = Member(self, creator_id, None, None, None, None, [], 0, 0, 0, '#fff')
|
381
395
|
if not creator:
|
382
396
|
return None
|
383
397
|
else:
|
@@ -399,7 +413,14 @@ class ArizonaAPI:
|
|
399
413
|
return None
|
400
414
|
|
401
415
|
create_date_tag = post_article.find('time')
|
402
|
-
create_date =
|
416
|
+
create_date = 0
|
417
|
+
if create_date_tag and create_date_tag.has_attr('data-time'):
|
418
|
+
data_time_value = create_date_tag['data-time']
|
419
|
+
if data_time_value.isdigit():
|
420
|
+
create_date = int(data_time_value)
|
421
|
+
else:
|
422
|
+
create_date = 0
|
423
|
+
|
403
424
|
|
404
425
|
html_content_tag = post_article.find('div', {'class': 'bbWrapper'})
|
405
426
|
html_content = str(html_content_tag) if html_content_tag else ""
|
@@ -460,7 +481,7 @@ class ArizonaAPI:
|
|
460
481
|
try:
|
461
482
|
last_register_member = await self.get_member(last_user_id)
|
462
483
|
except Exception as e:
|
463
|
-
last_register_member = Member(self, last_user_id, None, None, None, [], 0, 0, 0, '#fff')
|
484
|
+
last_register_member = Member(self, last_user_id, None, None, None, None, [], 0, 0, 0, '#fff')
|
464
485
|
except (AttributeError, ValueError, Exception) as e:
|
465
486
|
pass
|
466
487
|
|
@@ -755,7 +776,6 @@ class ArizonaAPI:
|
|
755
776
|
print(f"Ошибка сети при игнорировании/отмене игнорирования пользователя {member_id}: {e}")
|
756
777
|
raise e
|
757
778
|
|
758
|
-
|
759
779
|
async def add_profile_message(self, member_id: int, message_html: str) -> aiohttp.ClientResponse:
|
760
780
|
if not self._session or self._session.closed:
|
761
781
|
raise Exception("Сессия не активна. Вызовите connect() сначала.")
|
@@ -952,6 +972,32 @@ class ArizonaAPI:
|
|
952
972
|
except aiohttp.ClientError as e:
|
953
973
|
print(f"Ошибка сети при ответе в теме {thread_id}: {e}")
|
954
974
|
raise e
|
975
|
+
|
976
|
+
async def close_thread(self, thread_id: int) -> aiohttp.ClientResponse:
|
977
|
+
if not self._session or self._session.closed:
|
978
|
+
raise Exception("Сессия не активна. Вызовите connect() сначала.")
|
979
|
+
token = await self.token
|
980
|
+
url = f"{MAIN_URL}/threads/{thread_id}/quick-close"
|
981
|
+
payload = {'_xfToken': token}
|
982
|
+
try:
|
983
|
+
response = await self._session.post(url, data=payload)
|
984
|
+
return response
|
985
|
+
except aiohttp.ClientError as e:
|
986
|
+
print(f"Ошибка сети при закрытии/открытии темы {thread_id}: {e}")
|
987
|
+
raise e
|
988
|
+
|
989
|
+
async def pin_thread(self, thread_id: int) -> aiohttp.ClientResponse:
|
990
|
+
if not self._session or self._session.closed:
|
991
|
+
raise Exception("Сессия не активна. Вызовите connect() сначала.")
|
992
|
+
token = await self.token
|
993
|
+
url = f"{MAIN_URL}/threads/{thread_id}/quick-stick"
|
994
|
+
payload = {'_xfToken': token}
|
995
|
+
try:
|
996
|
+
response = await self._session.post(url, data=payload)
|
997
|
+
return response
|
998
|
+
except aiohttp.ClientError as e:
|
999
|
+
print(f"Ошибка сети при закреплении/откреплении темы {thread_id}: {e}")
|
1000
|
+
raise e
|
955
1001
|
|
956
1002
|
async def watch_thread(self, thread_id: int, email_subscribe: bool = False, stop: bool = False) -> aiohttp.ClientResponse:
|
957
1003
|
if not self._session or self._session.closed:
|
@@ -10,7 +10,7 @@ if TYPE_CHECKING:
|
|
10
10
|
|
11
11
|
|
12
12
|
class Member:
|
13
|
-
def __init__(self, API : 'ArizonaAPI', id: int, username: str, user_title: str, avatar: str, roles: list, messages_count: int, reactions_count: int, trophies_count: int, username_color: str) -> None:
|
13
|
+
def __init__(self, API : 'ArizonaAPI', id: int, username: str, user_title: str, avatar: str, roles: list, activity: str, messages_count: int, reactions_count: int, trophies_count: int, username_color: str) -> None:
|
14
14
|
self.API = API
|
15
15
|
self.id = id
|
16
16
|
"""**ID пользователя**"""
|
@@ -22,7 +22,8 @@ class Member:
|
|
22
22
|
"""**Ссылка на аватарку пользователя**"""
|
23
23
|
self.roles = roles
|
24
24
|
"""Роль пользователя на форуме ('покраска')"""
|
25
|
-
|
25
|
+
self.activity = activity
|
26
|
+
"""**Активность пользователя на форуме**"""
|
26
27
|
self.messages_count = messages_count
|
27
28
|
"""**Количество сообщений в счетчике**"""
|
28
29
|
self.reactions_count = reactions_count
|
@@ -46,6 +46,12 @@ class Thread:
|
|
46
46
|
"""
|
47
47
|
|
48
48
|
return await self.API.answer_thread(self.id, message_html)
|
49
|
+
|
50
|
+
async def close(self) -> aiohttp.ClientResponse:
|
51
|
+
return await self.API.close_thread(self.id)
|
52
|
+
|
53
|
+
async def pin(self) -> aiohttp.ClientResponse:
|
54
|
+
return await self.API.pin_thread(self.id)
|
49
55
|
|
50
56
|
|
51
57
|
async def watch(self, email_subscribe: bool = False, stop: bool = False) -> aiohttp.ClientResponse:
|
File without changes
|
{arizona_forum_api_async-1.1.3.dist-info → arizona_forum_api_async-1.3.dist-info}/top_level.txt
RENAMED
File without changes
|