Skip to main content

itd-sdk

ncruff EffVer Versioning

SDK для работы с https://xn--d1ah4a.com на python.

Документация: https://itdsdk.qzz.io/docs (wip)

Установка

uv add itd-sdk

или через pip:

pip install itd-sdk

Вход

Сейчас есть 3 способа авторизации в SDK:

  1. Без авторизации. Доступен поиск и хэштэги.
  2. Авторизация через access_token. Доступны все запросы кроме тех, которые связаны с авторизацией. Токен действует 15 минут.
  3. Авторизация через refresh_token. Доступны все запросы. Токен действует 7 дней.

Получение refresh_token

  1. Откройте итд.com в браузере
  2. Откройте DevTools (F12)
  3. Перейдите на вкладку "Network" \ "Сеть"
  4. Обновите страницу
  5. Найдите запрос к /v1/auth/refresh
  6. Скопируйте значение refresh_token из Cookies \ Куки

token

Получение access_token

  1. Откройте итд.com в браузере
  2. Откройте DevTools (F12)
  3. Перейдите на вкладку "Network" \ "Сеть"
  4. Откройте любой запрос (если запросов нету, подождите 1-3сек - итд постоянно посылает запросы на обновление статистики постов)
  5. Скопируйте значение authozation из Request headers \ Заголовки запроса

token

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

Star History Chart

Metadata

Release files for itd-sdk 2.10.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for itd-sdk 2.10.3
File Size Uploaded Provenance Actions
itd_sdk-2.10.3.tar.gz 70.8 kB Without provenance Details for itd_sdk-2.10.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for itd-sdk 2.10.3
File Interpreter ABI Platform Actions
itd_sdk-2.10.3-py3-none-any.whl Python 3 none any Details for itd_sdk-2.10.3-py3-none-any.whl

Total release size: 161.3 kB

Release files / itd_sdk-2.10.3.tar.gz

Download URL itd_sdk-2.10.3.tar.gz
Size 70.8 kB
Tags Source
SHA-256 checksum
How to use checksums
59b54ee45ce6492922c8142fd59c9fbe8067770ca1f271194811bad29795b45a
BLAKE2b-256 checksum
How to use checksums
7130aa09908eae3379ae6954aa31d5c5680ea76f5f16c2af71abd8ba03c68d0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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.10.3-py3-none-any.whl

Download URL itd_sdk-2.10.3-py3-none-any.whl
Size 90.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
895d1221ea4ff443e5b37a59448cf76f6251feb35e2b5c384dbaef2fae1ffa5e
BLAKE2b-256 checksum
How to use checksums
2f02d2efbc91d6bf7f79a5ad794eb761f8e6b557c328a42af5fa3441a6409976
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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.10.3

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.

Release history Release notifications | RSS feed

This release

2.10.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page