blob: 7e3c6f7ba1c5d77a138e6240ce67b47542037058 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import os
os.chdir("/root/yaoi-communism")
from twython import Twython
import get_images
twitter = Twython(*get_images.CONFIG["twitterapi"].values())
def post():
impath, source, text = get_images.main()
with open(impath, "rb") as img:
response = twitter.upload_media(media = img)
message = f"{text} ({source})"
out = twitter.update_status(status=message, media_ids=[response["media_id"]])
get_images.logging.info("Posted to twitter.")
if __name__ == "__main__":
post()
|