1
0
Fork 0
mirror of https://gitlab.com/oloturia/fumcaso.git synced 2024-11-01 01:38:16 +01:00
fumcaso/mastodon_main.py
2019-09-25 12:35:05 +02:00

22 lines
677 B
Python
Executable file

#!/usr/bin/env python3
from randstrip import createStrip
from mastodon import Mastodon
import os
fileDir = os.path.dirname(os.path.abspath(__file__))
fileDir = fileDir +"/"
API_URL = "https://botsin.space"
if __name__ == "__main__":
with open(fileDir+"createapp") as f:
createapp = f.readlines()
createapp = [x.strip() for x in createapp]
TOKEN = createapp[0]
mastodon = Mastodon(access_token = TOKEN,api_base_url = API_URL)
status = createStrip("mastodon.png")
if status == 0:
new_strip = mastodon.media_post(fileDir+"mastodon.png","image/png")
mastodon.status_post("Nuova striscia",media_ids=new_strip)
else:
print("error creating image\n")
print(status)