Client
itd.client
Client
cookies
cookies = cookies
token
token = replace('Bearer ', '')
add_comment
add_comment(post_id: UUID, content: str, attachment_ids: list[UUID] = []) -> Comment
Добавить комментарий
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
post_id
|
str
|
UUID поста |
required |
content
|
str
|
Содержание |
required |
attachment_ids
|
list[UUID]
|
Список UUID прикреплённых файлов |
[]
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
Ошибка валидации |
NotFound
|
Пост не найден |
Returns:
| Name | Type | Description |
|---|---|---|
Comment |
Comment
|
Комментарий |
add_reply_comment
add_reply_comment(comment_id: UUID, content: str, author_id: UUID, attachment_ids: list[UUID] = []) -> Comment
Добавить ответный комментарий
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
comment_id
|
str
|
UUID комментария |
required |
content
|
str
|
Содержание |
required |
author_id
|
UUID | None
|
ID пользователя, отправившего комментарий. Defaults to None. |
required |
attachment_ids
|
list[UUID]
|
Список UUID прикреплённых файлов |
[]
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
Ошибка валидации |
NotFound
|
Пользователь или комментарий не найден |
Returns:
| Name | Type | Description |
|---|---|---|
Comment |
Comment
|
Комментарий |
change_password
change_password(old: str, new: str) -> dict
Смена пароля
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old
|
str
|
Старый пароль |
required |
new
|
str
|
Новый пароль |
required |
Raises:
| Type | Description |
|---|---|
NoCookie
|
Нет cookie |
SamePassword
|
Одинаковые пароли |
InvalidOldPassword
|
Старый пароль неверный |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Ответ API |
create_post
create_post(content: str | None = None, spans: list[Span] = [], wall_recipient_id: UUID | None = None, attachment_ids: list[UUID] = [], poll: PollData | None = None) -> NewPost
Создать пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str | None
|
Содержимое. Defaults to None. |
None
|
spans
|
list[Span]
|
Стилизация содержимого. Defaults to []. |
[]
|
wall_recipient_id
|
UUID | None
|
UUID пользователя (чтобы создать пост ему на стене). Defaults to None. |
None
|
attachment_ids
|
list[UUID]
|
UUID вложений. Defaults to []. |
[]
|
poll
|
PollData | None
|
Опрос. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пользователь не найден |
Forbidden
|
Некоторые файлы не принадлежат вам |
ValidationError
|
Ошибка валидации |
RequiresVerification
|
Для загрузки видео нужна верификация |
Returns:
| Name | Type | Description |
|---|---|---|
NewPost |
NewPost
|
Новый пост |
delete_comment
delete_comment(id: UUID) -> None
Удалить комментарий
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID комментария |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Комментарий не найден |
Forbidden
|
Нет прав на удаление |
delete_file
delete_file(id: UUID) -> File
Удалить файл
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID файла |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Файл не найден |
delete_post
delete_post(id: UUID) -> None
Удалить пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID поста |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
Forbidden
|
Нет доступа |
edit_post
edit_post(id: UUID, content: str, spans: list[Span] = []) -> str
Редактировать пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID поста |
required |
content
|
str
|
Содержимое |
required |
spans
|
list[Span]
|
Стилизация содержимого. Defaults to []. |
[]
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
Forbidden
|
Нет доступа |
ValidationError
|
Ошибка валидации |
EditExpired
|
Редактирование доступно только в течение 48 часов после публикации |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Новое содержимое |
follow
follow(username: str) -> int
Подписаться на пользователя
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
username |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пользователь не найден |
CantFollowYourself
|
Невозможно подписаться на самого себе |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Число подписчиков после подписки |
get_comments
get_comments(post_id: UUID, limit: int = 20, cursor: int = 0, sort: str = 'popular') -> tuple[list[Comment], Pagination]
Получить список комментариев
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
post_id
|
UUID
|
UUID поста |
required |
limit
|
int
|
Лимит. Defaults to 20. |
20
|
cursor
|
int
|
Курсор (сколько пропустить). Defaults to 0. |
0
|
sort
|
str
|
Сортировка. Defaults to 'popular'. |
'popular'
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
Returns:
| Name | Type | Description |
|---|---|---|
list[Comment]
|
list[Comment]: Список комментариев |
|
Pagination |
Pagination
|
Пагинация |
get_file
get_file(id: UUID) -> File
Получить файл
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID файла |
required |
Raises:
| Type | Description |
|---|---|
NotFoundOrForbidden
|
Файл не найден или нет доступа |
Returns:
| Name | Type | Description |
|---|---|---|
File |
File
|
Файл |
get_followers
get_followers(username: str, limit: int = 30, page: int = 1) -> tuple[list[UserFollower], Pagination]
Получить подписчиков пользователя
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
username |
required |
limit
|
int
|
Лимит. Defaults to 30. |
30
|
page
|
int
|
Страница (при дозагрузке, увеличивайте на 1). Defaults to 1. |
1
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пользователь не найден |
Returns:
| Name | Type | Description |
|---|---|---|
list[UserFollower]
|
list[UserFollower]: Список подписчиков |
|
Pagination |
Pagination
|
Данные пагинации (лимит, страница, сколько всего, есть ли еще) |
get_following
get_following(username: str, limit: int = 30, page: int = 1) -> tuple[list[UserFollower], Pagination]
Получить подписки пользователя
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
username |
required |
limit
|
int
|
Лимит. Defaults to 30. |
30
|
page
|
int
|
Страница (при дозагрузке, увеличивайте на 1). Defaults to 1. |
1
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пользователь не найден |
Returns:
| Name | Type | Description |
|---|---|---|
list[UserFollower]
|
list[UserFollower]: Список подписок |
|
Pagination |
Pagination
|
Данные пагинации (лимит, страница, сколько всего, есть ли еще) |
get_hashtags
get_hashtags(limit: int = 10) -> list[Hashtag]
Получить список популярных хэштэгов
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
Лимит. Defaults to 10. |
10
|
Returns:
| Type | Description |
|---|---|
list[Hashtag]
|
list[Hashtag]: Список хэштэгов |
get_liked_posts
get_liked_posts(username_or_id: str | UUID, limit: int = 20, cursor: datetime | None = None) -> tuple[list[Post], LikedPostsPagintaion]
Получить список лайкнутых постов пользователя
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username_or_id
|
str | UUID
|
UUID или username пользователя |
required |
limit
|
int
|
Лимит. Defaults to 20. |
20
|
cursor
|
datetime | None
|
Сдвиг (next_cursor). Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пользователь не найден |
Returns:
| Name | Type | Description |
|---|---|---|
list[Post]
|
list[Post]: Список постов |
|
LikedPostsPagintaion |
LikedPostsPagintaion
|
Пагинация |
get_me
get_me() -> User
get_notifications
get_notifications(limit: int = 20, offset: int = 0) -> tuple[list[Notification], Pagination]
Получить уведомления
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int
|
Лимит. Defaults to 20. |
20
|
offset
|
int
|
Сдвиг. Defaults to 0. |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
list[Notification]
|
list[Notification]: Уведомления |
|
Pagination |
Pagination
|
Пагинация |
get_pins
get_pins() -> tuple[list[Pin], str]
get_platform_status
get_platform_status() -> bool
Получить статус платформы
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
read only |
get_post
get_post(id: UUID) -> Post
Получить пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID поста |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
Returns:
| Name | Type | Description |
|---|---|---|
Post |
Post
|
Пост |
get_posts
get_posts(cursor: int = 0, limit: int = 20, tab: PostsTab = POPULAR) -> tuple[list[Post], PostsPagintaion]
Получить список постов
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cursor
|
int
|
Страница. Defaults to 0. |
0
|
limit
|
int
|
Лимит. Defaults to 20. |
20
|
tab
|
PostsTab
|
Вкладка (популярное или подписки). Defaults to PostsTab.POPULAR. |
POPULAR
|
Returns:
| Name | Type | Description |
|---|---|---|
list[Post]
|
list[Post]: Список постов |
|
Pagination |
PostsPagintaion
|
Пагинация |
get_posts_by_hashtag
get_posts_by_hashtag(hashtag: str, limit: int = 20, cursor: UUID | None = None) -> tuple[Hashtag | None, list[Post], Pagination]
Получить посты по хэштэгу
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hashtag
|
str
|
Хэштэг (без #) |
required |
limit
|
int
|
Лимит. Defaults to 20. |
20
|
cursor
|
UUID | None
|
Курсор (UUID последнего поста, после которого брать данные). Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Hashtag | None
|
Hashtag | None: Хэштэг |
|
list[Post]
|
list[Post]: Посты |
|
Pagination |
Pagination
|
Пагинация |
get_replies
get_replies(comment_id: UUID, limit: int = 50, page: int = 1, sort: str = 'oldest') -> tuple[list[Comment], Pagination]
Получить список ответов на комментарий
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
comment_id
|
UUID
|
UUID поста |
required |
limit
|
int
|
Лимит. Defaults to 50. |
50
|
page
|
int
|
Курсор (сколько пропустить). Defaults to 1. |
1
|
sort
|
str
|
Сортировка. Defaults to 'oldest'. |
'oldest'
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
Returns:
| Name | Type | Description |
|---|---|---|
list[Comment]
|
list[Comment]: Список комментариев |
|
Pagination |
Pagination
|
Пагинация |
get_top_clans
get_top_clans() -> list[Clan]
get_unread_notifications_count
get_unread_notifications_count() -> int
Получить количество непрочитанных уведомлений
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Количество |
get_user
get_user(username: str) -> User
Получить пользователя
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
username или "me" |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пользователь не найден |
UserBanned
|
Пользователь заблокирован |
Returns:
| Name | Type | Description |
|---|---|---|
User |
User
|
Пользователь |
get_user_posts
get_user_posts(username_or_id: str | UUID, limit: int = 20, cursor: datetime | None = None, pinned_post_id: UUID | None = None, sort: UserPostSorting = NEW) -> tuple[list[Post], LikedPostsPagintaion]
Получить список постов пользователя
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username_or_id
|
str | UUID
|
UUID или username пользователя |
required |
limit
|
int
|
Лимит. Defaults to 20. |
20
|
cursor
|
datetime | None
|
Сдвиг (next_cursor). Defaults to None. |
None
|
pinned_post_id
|
UUID | None
|
UUID закрепленного поста. Defaults to None. |
None
|
sort
|
UserPostSorting | None
|
Сортировка. Defaults to UserPostSorting.NEW. |
NEW
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пользователь не найден |
Returns:
| Name | Type | Description |
|---|---|---|
list[Post]
|
list[Post]: Список постов |
|
LikedPostsPagintaion |
LikedPostsPagintaion
|
Пагинация |
get_verification_status
get_verification_status() -> VerificationStatus
Получить статус верификации
Returns:
| Name | Type | Description |
|---|---|---|
VerificationStatus |
VerificationStatus
|
Верификация |
get_who_to_follow
get_who_to_follow() -> list[UserWhoToFollow]
Получить список популярных пользователей (кого читать)
Returns:
| Type | Description |
|---|---|
list[UserWhoToFollow]
|
list[UserWhoToFollow]: Список пользователей |
like_comment
like_comment(id: UUID) -> int
Лайкнуть комментарий
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID комментария |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Комментарий не найден |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Количество лайков |
like_post
like_post(post_id: UUID) -> int
Лайкнуть пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
post_id
|
UUID
|
UUID поста |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Количество лайков |
logout
logout() -> dict
Выход из аккаунта
Raises:
| Type | Description |
|---|---|
NoCookie
|
Нет cookie |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Ответ API |
mark_all_as_read
mark_all_as_read() -> None
Прочитать все уведомления
mark_as_read
mark_as_read(id: UUID) -> bool
Прочитать уведомление
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID уведомления |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
Успешно (False - уже прочитано) |
pin_post
pin_post(id: UUID)
Закрепить пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID поста |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
Forbidden
|
Нет доступа |
refresh_auth
refresh_auth() -> str
Обновить access token
Raises:
| Type | Description |
|---|---|
NoCookie
|
Нет cookie |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Токен |
remove_pin
remove_pin()
Снять пин
report
report(id: UUID, type: ReportTargetType = POST, reason: ReportTargetReason = OTHER, description: str | None = None) -> NewReport
Отправить жалобу
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID цели |
required |
type
|
ReportTargetType
|
Тип цели (пост/пользователь/комментарий). Defaults to ReportTargetType.POST. |
POST
|
reason
|
ReportTargetReason
|
Причина. Defaults to ReportTargetReason.OTHER. |
OTHER
|
description
|
str | None
|
Описание. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Цель не найдена |
AlreadyReported
|
Жалоба уже отправлена |
ValidationError
|
Ошибка валидации |
Returns:
| Name | Type | Description |
|---|---|---|
NewReport |
NewReport
|
Новая жалоба |
repost
repost(id: UUID, content: str | None = None) -> NewPost
Репостнуть пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID поста |
required |
content
|
str | None
|
Содержимое (доп. комментарий). Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
AlreadyReposted
|
Пост уже репостнут |
CantRepostYourPost
|
Нельзя репостить самого себя |
ValidationError
|
Ошибка валидации |
Returns:
| Name | Type | Description |
|---|---|---|
NewPost |
NewPost
|
Новый пост |
restore_post
restore_post(post_id: UUID) -> None
Восстановить удалённый пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
post_id
|
UUID
|
UUID поста |
required |
search
search(query: str, user_limit: int = 5, hashtag_limit: int = 5) -> tuple[list[UserWhoToFollow], list[Hashtag]]
Поиск по пользователям и хэштэгам
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Запрос |
required |
user_limit
|
int
|
Лимит пользователей. Defaults to 5. |
5
|
hashtag_limit
|
int
|
Лимит хэштэгов. Defaults to 5. |
5
|
Raises:
| Type | Description |
|---|---|
TooLarge
|
Слишком длинный запрос |
Returns:
| Type | Description |
|---|---|
list[UserWhoToFollow]
|
list[UserWhoToFollow]: Список пользователей |
list[Hashtag]
|
list[Hashtag]: Список хэштэгов |
search_hashtag
search_hashtag(query: str, limit: int = 5) -> list[Hashtag]
Поиск хэштэгов
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Запрос |
required |
limit
|
int
|
Лимит. Defaults to 5. |
5
|
Returns:
| Type | Description |
|---|---|
list[Hashtag]
|
list[Hashtag]: Список хэштэгов |
search_user
search_user(query: str, limit: int = 5) -> list[UserWhoToFollow]
Поиск пользователей
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Запрос |
required |
limit
|
int
|
Лимит. Defaults to 5. |
5
|
Returns:
| Type | Description |
|---|---|
list[UserWhoToFollow]
|
list[UserWhoToFollow]: Список пользователей |
set_pin
set_pin(slug: str)
stop_stream
stop_stream()
Остановить прослушивание SSE потока
Example
import threading
from itd import ITDClient
client = ITDClient(cookies='refresh_token=...')
# Запуск в отдельном потоке
def listen():
for event in client.stream_notifications():
print(event)
thread = threading.Thread(target=listen)
thread.start()
# Остановка через 10 секунд
import time
time.sleep(10)
client.stop_stream()
thread.join()
stream_notifications
stream_notifications() -> Iterator[StreamConnect | StreamNotification]
Слушать SSE поток уведомлений
Yields:
| Type | Description |
|---|---|
StreamConnect | StreamNotification
|
StreamConnect | StreamNotification: События подключения или уведомления |
Example
from itd import ITDClient
client = ITDClient(cookies='refresh_token=...')
# Запуск прослушивания
for event in client.stream_notifications():
if isinstance(event, StreamConnect):
print(f'Подключено: {event.user_id}')
else:
print(f'Уведомление: {event.type} от {event.actor.username}')
# Остановка из другого потока или обработчика
# client.stop_stream()
unfollow
unfollow(username: str) -> int
Отписаться от пользователя
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
username |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пользователь не найден |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Число подписчиков после отписки |
unlike_comment
unlike_comment(id: UUID) -> int
Убрать лайк с комментария
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID комментария |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Комментарий не найден |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Количество лайков |
unlike_post
unlike_post(post_id: UUID) -> int
Убрать лайк с поста
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
post_id
|
UUID
|
UUID поста |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Количество лайков |
update_banner
update_banner(name: str) -> UserProfileUpdate
[DEPRECATED] Обновить банер (шорткат из upload_file + update_profile)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Имя файла |
required |
Returns:
| Name | Type | Description |
|---|---|---|
UserProfileUpdate |
UserProfileUpdate
|
Обновленный профиль |
update_banner_new
update_banner_new(name: str) -> tuple[File, UserProfileUpdate]
Обновить банер (шорткат из upload_file + update_profile)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Имя файла |
required |
Returns:
| Name | Type | Description |
|---|---|---|
File |
File
|
Загруженный файл |
UserProfileUpdate |
UserProfileUpdate
|
Обновленный профиль |
update_privacy
update_privacy(wall_closed: bool = False, private: bool = False) -> UserPrivacy
(УСТАРЕЛО! Используйте update_privacy_new) настройки приватности
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wall_closed
|
bool
|
Закрыть стену. Defaults to False. |
False
|
private
|
bool
|
Приватность. На данный момент неизвестно, что делает этот параметр. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
UserPrivacy |
UserPrivacy
|
Обновленные данные приватности |
update_privacy_new
update_privacy_new(privacy: UserPrivacyData) -> UserPrivacy
Обновить настройки приватности
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
privacy
|
UserPrivacyData
|
Данные приватности |
required |
Returns:
| Name | Type | Description |
|---|---|---|
UserPrivacy |
UserPrivacy
|
Обновленные данные приватности |
update_profile
update_profile(username: str | None = None, display_name: str | None = None, bio: str | None = None, banner_id: UUID | Unset | None = None) -> UserProfileUpdate
Обновить профиль
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str | None
|
username. Defaults to None. |
None
|
display_name
|
str | None
|
Отображаемое имя. Defaults to None. |
None
|
bio
|
str | None
|
Биография (о себе). Defaults to None. |
None
|
banner_id
|
UUID | Unset | None
|
UUID баннера. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
Ошибка валидации |
InvalidFileType
|
Баннер может быть только изображением |
Returns:
| Name | Type | Description |
|---|---|---|
UserProfileUpdate |
UserProfileUpdate
|
Обновленный профиль |
upload_file
upload_file(name: str, data: BufferedReader) -> File
Загрузить файл
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Имя файла |
required |
data
|
BufferedReader
|
Содержимое (open('имя', 'rb')) |
required |
Raises:
| Type | Description |
|---|---|
TooLarge
|
Слишком большой файл |
InvalidFileType
|
Неправильный тип файла |
UploadError
|
Ошибка загрузки файла |
Returns:
| Name | Type | Description |
|---|---|---|
File |
File
|
Файл |
verify
verify(file_url: str) -> Verification
Отправить запрос на верификацию
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_url
|
str
|
Ссылка на видео |
required |
Raises:
| Type | Description |
|---|---|
PendingRequestExists
|
Запрос уже отправлен |
Returns:
| Name | Type | Description |
|---|---|---|
Verification |
Verification
|
Верификация |
view_post
view_post(id: UUID) -> None
Просмотреть пост
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID поста |
required |
Raises:
| Type | Description |
|---|---|
NotFound
|
Пост не найден |
vote
vote(id: UUID, option_ids: list[UUID]) -> Poll
Проголосовать в опросе
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
UUID поста |
required |
option_ids
|
list[UUID]
|
Список UUID вариантов |
required |
Raises:
| Type | Description |
|---|---|
EmptyOptions
|
Пустые варианты |
NotFound
|
Пост не найден или в посте нет опроса |
OptionsNotBelong
|
Неверные варианты (варинты не пренадлежат опросу) |
NotMultipleChoice
|
Можно выбрать только 1 вариант (для опросов, где не разрешены несколько ответов) |
Returns:
| Name | Type | Description |
|---|---|---|
Poll |
Poll
|
Опрос |
refresh_on_error
refresh_on_error(func)