Site automation tools
Project description
Better Site Automation
pip install better-automation
import aiohttp
from better_automation import TwitterAPI
async def twitter_demo():
async with aiohttp.ClientSession() as session:
twitter = TwitterAPI(session, "auth_token")
# Запрашиваем имя пользователя
username = await twitter.request_username()
print(f"Your username: {username}")
# Подписываемся на Илона Маска
user_handle = "@elonmusk"
user_id = await twitter.request_user_id(user_handle)
print(f"{user_handle} is followed: {await twitter.follow(user_id)}")
# Загружаем твит с аниме девочкой
img_url = "https://cdn.donmai.us/original/26/cd/__chloe_von_einzbern_fate_and_1_more_drawn_by_anzu_ame__26cdf525d657a8c14cc8758160bc6284.jpg"
media_id = await twitter.upload_image(img_url)
print(f"Media id: {media_id}")
tweet_id = await twitter.tweet("I love YOU!!!!", media_id=media_id)
print(f"Tweet {tweet_id} is pinned: {await twitter.pin_tweet(tweet_id)}")
# Запрашиваем информацию о твите
tweet_data = await twitter.request_tweet_data(tweet_id)
print(tweet_data)
# Ретвит, лайк, реплай
another_tweet_id = 1692431667548528661
print(f"Tweet {another_tweet_id} is retweeted. Tweet id: {await twitter.retweet(another_tweet_id)}")
print(f"Tweet {another_tweet_id} is liked: {await twitter.like(another_tweet_id)}")
print(f"Tweet {another_tweet_id} is replied. Reply id: {await twitter.reply(another_tweet_id, 'I love YOU!!!')}")
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
better_automation-0.2.1.tar.gz
(26.9 kB
view hashes)
Built Distribution
Close
Hashes for better_automation-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b71a04518152c333507b1bee9466baf832caffd3d9cbf9d772e9159cd830cb1 |
|
MD5 | 6560f6bab9657a3fc0e75b726cd7df2e |
|
BLAKE2b-256 | 2517f6bb93b32f4eb580efabc92076fe655733765b2a1b174a5fc2a582b17055 |