Skip to main content

Python SDK for ИТД.com API

Project description

ITDpy

Python SDK для социальной сети итд.com.

⚠️ Неофициальный API-клиент.
SDK предназначен для разработки клиентских приложений и тестирования API в рамках действующих правил платформы.

Установка pip

pip install itdpy

Через git

git clone https://github.com/Gam5510/ITDpy
cd itdpy
pip install -r requirements.txt
pip install -e .

Документация


Модули


Модели

Быстрый старт

Blockquote Получение токена Как получить токен

from  itdpy.client  import  ITDClient

client  =  ITDClient(refresh_token="Ваш refresh token")

me  =  client.get_me()
print(me.id)
print(me.username)

Скрипт на обновление имени

from  itdpy.client  import  ITDClient
from  datetime  import  datetime
import  time

client = ITDClient(refresh_token="Ваш_токен")

while  True:
	client.update_profile(display_name=f"Фазлиддин |{datetime.now().strftime('%m.%d %H:%M:%S')}|")
	time.sleep(1)

Скрипт на обновление баннера

from  itdpy.client  import  ITDClient

client  =  ITDClient(refresh_token="Ваш_токен")

file  =  client.upload_file(client,  "matrix-rain-effect-animation-photoshop-editor.gif")
print(file.id)
update  =  update_profile(client,  banner_id=file.id)
print(update.banner)

Костомные запросы

✅ Базовый пример кастомного GET

response = client.get("/api/users/me")
data = response.json() 
print(data)

Можно добавить любой эндпоинт


✅ POST с JSON

response = client.post( 
		"/api/posts",
    json={ "content": "Привет из кастомного запроса" }
) 
print(response.status_code) 
print(response.json())

✅ PUT / PATCH

response = client.patch( "/api/profile",
    json={ "displayName": "Фазлиддин 😎" }
)

✅ DELETE

client.delete("/api/posts/POST_ID") 

✅ Передача query-параметров

response = client.get( "/api/posts",
    params={ "limit": 50, "sort": "popular" }
)

Планы

  • Асинхронная версия библиотеки (aioitd)
  • Улучшенная обработка и форматирование ошибок
  • Логирование (через logging)
  • Расширение объектной модели (Post, Comment, User и др.)
  • Дополнительные API-эндпоинты по мере появления
  • Улучшение документации и примеров

Прочее

Проект активно развивается. Если у вас есть идеи или предложения — создавайте issue или pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itdpy-0.3.2.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

itdpy-0.3.2-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file itdpy-0.3.2.tar.gz.

File metadata

  • Download URL: itdpy-0.3.2.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for itdpy-0.3.2.tar.gz
Algorithm Hash digest
SHA256 a331a5630b1339ef9322989fd12e0f898fe9f8048d20ee3436adb3cbb08458c2
MD5 b324611e1bf4713455d48a80b76e98e8
BLAKE2b-256 cb03b3ab2e85e90e2dac98ba27da25cfd9def26497eecd4c605c62a7a3ab259b

See more details on using hashes here.

File details

Details for the file itdpy-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: itdpy-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for itdpy-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5f66a341d65d7eb3ea8347b7a73ba7a7ccf110834a21dce9ec4e62b05d1266c9
MD5 f1b60cd4eaec706ce2bbc1ef84eb6eca
BLAKE2b-256 6524190c54cf740c404eef06b6edba75a68e53b83605962a8eb748abb43cbe7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page