Основные методы

Инициализация

api = ArizonaAPI(user_agent: str, cookie: dict)
Создает новый экземпляр API клиента.
  • user_agent - строка User-Agent браузера
  • cookie - словарь с cookies (xf_session, xf_tfa_trust, xf_user)

Подключение и отключение

await api.connect(do_bypass: bool = True)
Устанавливает соединение с форумом и выполняет авторизацию.
  • do_bypass - выполнять ли обход антибота (по умолчанию True)
await api.close()
Закрывает соединение и освобождает ресурсы.

CSRF токен

await api.token: str
Получает актуальный CSRF токен для запросов.

Основные операции

await api.get_current_member(): CurrentMember
Возвращает объект текущего авторизованного пользователя.
await api.get_category(category_id: int): Category | None
Получает категорию по ID.
await api.get_member(user_id: int): Member | None
Получает пользователя по ID.
await api.get_thread(thread_id: int): Thread | None
Получает тему по ID.
await api.get_post(post_id: int): Post | None
Получает сообщение по ID.
await api.get_profile_post(post_id: int): ProfilePost | None
Получает сообщение профиля по ID.
await api.get_forum_statistic(): Statistic | None
Получает общую статистику форума.

Работа с категориями

Получение информации

await api.get_category(category_id: int): Category
Получает подробную информацию о категории.

Создание темы

await api.create_thread(
    category_id: int,
    title: str, 
    message_html: str,
    discussion_type: str = 'discussion',
    watch_thread: bool = True
): aiohttp.ClientResponse
Создает новую тему в указанной категории.
  • category_id - ID категории
  • title - заголовок темы
  • message_html - текст сообщения (поддерживает BB-коды)
  • discussion_type - тип обсуждения (по умолчанию ‘discussion’)
  • watch_thread - подписаться на тему после создания

Управление категорией

await api.set_read_category(category_id: int): aiohttp.ClientResponse
Отмечает категорию как прочитанную.
await api.watch_category(
    category_id: int,
    notify: str = "watched_email",
    send_alert: bool = True,
    send_email: bool = False,
    stop: bool = False
): aiohttp.ClientResponse
Управляет подпиской на категорию.
  • notify - тип уведомлений
  • send_alert - отправлять уведомления на сайте
  • send_email - отправлять email уведомления
  • stop - отписаться от категории

Получение подкатегорий

await api.get_categories(category_id: int): List[int]

Методы для работы с пользователями

Подписка и игнорирование

await api.follow_member(member_id: int): Response
await api.ignore_member(member_id: int): Response

Сообщения профиля

await api.add_profile_message(member_id: int, message_html: str): Response
await api.get_profile_messages(member_id: int, page: int = 1): List[int]

Методы для работы с сообщениями

Действия с постами

await api.react_post(post_id: int, reaction_id: int = 1): Response
await api.edit_post(post_id: int, message_html: str): Response
await api.delete_post(post_id: int, reason: str, hard_delete: bool = False): Response
await api.bookmark_post(post_id: int): Response

Действия с сообщениями профиля

await api.react_profile_post(post_id: int, reaction_id: int = 1): Response
await api.comment_profile_post(post_id: int, message_html: str): Response
await api.delete_profile_post(post_id: int, reason: str, hard_delete: bool = False): Response
await api.edit_profile_post(post_id: int, message_html: str): Response

Методы для работы с темами

Основные действия

await api.answer_thread(thread_id: int, message_html: str): Response
await api.watch_thread(thread_id: int, email_subscribe: bool = False, stop: bool = False): Response
await api.delete_thread(thread_id: int, reason: str, hard_delete: bool = False): Response

Редактирование

await api.edit_thread(thread_id: int, message_html: str): Response
await api.edit_thread_info(
    thread_id: int,
    title: str,
    prefix_id: Optional[int] = None,
    sticky: bool = True,
    opened: bool = True
): Response

Получение информации

await api.get_thread_category(thread_id: int): Category
await api.get_thread_posts(thread_id: int, page: int = 1): List[str]
await api.get_all_thread_posts(thread_id: int): List[str]

Реакции

await api.react_thread(thread_id: int, reaction_id: int = 1): Response

Прочие методы

Отправка форм

await api.send_form(form_id: int, data: dict): Response

Уведомления

await api.get_notifications(): list