Python SDK for ИТД.com API
Project description
ITDpy
Python SDK для социальной сети ITD. Упрощает работу с 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
from itdpy.auth import AuthManager
from itdpy.api import get_me
client = ITDClient(refresh_token="Ваш refresh token")
auth = AuthManager(client)
auth.refresh_access_token()
me = get_me(client)
print(me.id)
print(me.username)
Скрипт на обновление имени
from itdpy.client import ITDClient
from itdpy.auth import AuthManager
from itdpy.api import update_profile
from datetime import datetime
import time
client = ITDClient(refresh_token="Ваш_токен")
auth = AuthManager(client)
auth.refresh_access_token()
while True:
update_profile(client, display_name=f"Фазлиддин |{datetime.now().strftime('%m.%d %H:%M:%S')}|")
time.sleep(1)
Скрипт на обновление баннера
from itdpy.client import ITDClient
from itdpy.auth import AuthManager
from itdpy.api import update_profile, upload_file
from datetime import datetime
import time
client = ITDClient(refresh_token="Ваш_токен")
auth = AuthManager(client)
auth.refresh_access_token()
file = 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
Release history Release notifications | RSS feed
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.1.4.tar.gz
(10.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
itdpy-0.1.4-py3-none-any.whl
(14.2 kB
view details)
File details
Details for the file itdpy-0.1.4.tar.gz.
File metadata
- Download URL: itdpy-0.1.4.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fe66d212d1b16da923d0f54ebcc27a5c29a8623cad789f121ba8f899ea0e1bf
|
|
| MD5 |
475680b66a49b7717aa49b76f808ed42
|
|
| BLAKE2b-256 |
ef6fddecb3ec651ee74c4282d5556fb8bd1e8c3fe70a6328f09f496bda7d8a43
|
File details
Details for the file itdpy-0.1.4-py3-none-any.whl.
File metadata
- Download URL: itdpy-0.1.4-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c52df868b9075ea8a6e177ea9365909a1cc2b813883c61f3f5af72fe89bdf223
|
|
| MD5 |
ae41d30f7fbae165dcb692e020d36b85
|
|
| BLAKE2b-256 |
2c0a727f88d0e6c8db65d192b576180d740082c3b4fa8cb1867cc1375187a73f
|