Асинхронный клиент для итд.com
Project description
aioitd
Асинхронный Python клиент для итд.com
Установка
pip install aioitd
Пример
from aioitd import AsyncITDClient
import asyncio
refresh_token = "ca1291a4a990b985a57b880ed3fb863eef80ac3990acc68e8f106a783e3af402"
async def main():
async with AsyncITDClient(refresh_token) as client:
user = await client.get_user("nowkie")
print(
f"id: {user.id}\n"
f"username: {user.username}\n"
f"follower_count: {user.followers_count}"
)
asyncio.run(main())
Чтобы получить refresh_token:
- Войди в аккаунт на итд.com
- Откройть devtools
- Среди табов выбрать network (сеть)
- Перезагрузить страницу
- Найти запрос
refresh - В куки запроса скопировать
refresh_token
Или:
- Войти в аккаунт на итд.com
- Откройть devtools
- Среди табов выбрать application (приложение)
- Выбрать куки и скопировать токен
AsyncITDClient
Автоматически вызывает refersh, по окончании срока жизни access токена.
async with AsyncITDClient(refresh_token) as client:
или
client = AsyncITDClient(refresh_token)
await client.start()
...
await client.close()
Создание поста
from aioitd import AsyncITDClient, File, Post
import asyncio
from uuid import UUID
refresh_token = "ВАШ ТОКЕН"
async def main():
async with AsyncITDClient(refresh_token) as client:
images_path = ["sun.png", "снег.gif", "python.jpg"]
files_ids: list[UUID] = []
for path in images_path:
with open(path, 'rb') as f:
file: File = await client.upload_file(f)
files_ids.append(file.id)
post: Post = await client.create_post("ТЕКСТ ПОСТА", attachment_ids=files_ids)
asyncio.run(main())
Поменять баннер
async def main():
async with AsyncITDClient(refresh_token) as client:
with open(r"file.gif", 'rb') as file:
image = await client.upload_file(file)
await client.update_profile(username="aioitd", banner_id=image.id)
Автор в итд aioitd, тг @rationessEps
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
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
aioitd-0.0.1-py3-none-any.whl
(16.1 kB
view details)
File details
Details for the file aioitd-0.0.1-py3-none-any.whl.
File metadata
- Download URL: aioitd-0.0.1-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
321e369d894b587eb78d5241883fb6aeff02fd413f3ff7c206fd6bb6fba8a261
|
|
| MD5 |
fe379a6ae9dcdb4e3e166132e9882f67
|
|
| BLAKE2b-256 |
1167048453912e1fbe54fc7918925955e8dc857a1895358106988fc0582697ed
|