itd-sdk
SDK для работы с https://xn--d1ah4a.com на python.
Документация: https://itdsdk.qzz.io/docs (wip)
Установка
uv add itd-sdk
или через pip:
pip install itd-sdk
Вход
Сейчас есть 3 способа авторизации в SDK:
- Без авторизации. Доступен поиск и хэштэги.
- Авторизация через
access_token. Доступны все запросы кроме тех, которые связаны с авторизацией. Токен действует 15 минут. - Авторизация через
refresh_token. Доступны все запросы. Токен действует 7 дней.
Получение refresh_token
- Откройте итд.com в браузере
- Откройте DevTools (F12)
- Перейдите на вкладку "Network" \ "Сеть"
- Обновите страницу
- Найдите запрос к
/v1/auth/refresh - Скопируйте значение refresh_token из Cookies \ Куки
Получение access_token
- Откройте итд.com в браузере
- Откройте DevTools (F12)
- Перейдите на вкладку "Network" \ "Сеть"
- Откройте любой запрос (если запросов нету, подождите 1-3сек - итд постоянно посылает запросы на обновление статистики постов)
- Скопируйте значение authozation из Request headers \ Заголовки запроса
API
from itd import ITDClient, init_client, Me, User, Post, Posts, File, Hashtag, Notifications
init_client() # попросит ввести refresh token в консоли
ITDClient(access='access token') # через access token
ITDClient('refresh token') # одноразовая инициализация (не рекомендуется)
me = Me() # получить себя
me.privacy.update(is_private=True)
user = User('itd_sdk') # получить пользователя
user.follow()
post = Post('725681ba-2aaa-42d8-87fb-490c0f44e162') # получить пост
post.like()
post.add_comment('тест комент 6 7')
Post('02bcbba4-f365-4b98-9291-d0bc1fb36fe4').poll.vote('тест') # голосования в опросах
posts = Posts() # получить посты из ленты
for i, post in enumerate(Posts()):
post.like() # встроенные защиты, из-за которых рейт-лимит будет получить сложнее + авто ожидание окончания рейт лимита
if i > 10:
break
post = user.posts[5] # индексация, авто-получение до нужного значения
post.repost()
file = File.from_path('1.jpg') # загрузка файлов
Post.new('всем привет!', attachments=file) # attachments может быть списком, файлом, или UUID
hashtag = Hashtag('тестапи') # получить данные хэштэга
print(hashtag.posts_count)
hashtag.posts[0].like()
notifications = Notifications() # получить уведы
notifications[30].read()
notifications.read_all()
for notification in notifications.stream(): # SSE уведомлений
print(notification.type.value)
break
def on_like(notification):
print('лайк от', notification.actor.username)
notifications.stop_stream()
notifications.on_like = on_like
stream = notifications.stream_bg() # background SSE
Весь API - https://itdsdk.qzz.io/docs/
Прочее
Star History
Metadata
Release files for itd-sdk 2.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| itd_sdk-2.11.0.tar.gz | 63.5 kB | Without provenance | Details for itd_sdk-2.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| itd_sdk-2.11.0-py3-none-any.whl | Python 3 | none | any | Details for itd_sdk-2.11.0-py3-none-any.whl |
Total release size: 146.9 kB
Release files / itd_sdk-2.11.0.tar.gz
| Download URL | itd_sdk-2.11.0.tar.gz |
|---|---|
| Size | 63.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dac60c55175eb2d19164eb936106c01caf7dad374adf53aa17285a9e565d1e6a
|
|
BLAKE2b-256 checksum How to use checksums |
764aba91c3d9d93bb940b5dceb79879457f75ef2f96178f4b3aa91ef12614f28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / itd_sdk-2.11.0-py3-none-any.whl
| Download URL | itd_sdk-2.11.0-py3-none-any.whl |
|---|---|
| Size | 83.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d11e0aeb50394d5ea2387190e89402244a175cb913b517898c4adea834b6ce6c
|
|
BLAKE2b-256 checksum How to use checksums |
a48e275c1a737dd77fa87aa06622cb10c60657379a052603e2d41676bfd4081a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for itd-sdk 2.11.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.