mastodon_main.py 684 B

12345678910111213141516171819202122
  1. #!/usr/bin/env python3
  2. from randstrip import createStrip
  3. from mastodon import Mastodon
  4. impor os
  5. fileDir = os.path.dirname(os.path.abspath(__file__))
  6. fileDir = fileDir +"/"
  7. API_URL = "https://botsin.space"
  8. if __name__ == "__main__":
  9. with open(fileDir+"createapp") as f:
  10. createapp = f.readlines()
  11. createapp = [x.strip() for x in createapp]
  12. TOKEN = createapp[0]
  13. mastodon = Mastodon(access_token = TOKEN,api_base_url = API_URL)
  14. status = createStrip(fileDir+"mastodon.png")
  15. if status == 0:
  16. new_strip = mastodon.media_post(fileDir+"mastodon.png","image/png")
  17. mastodon.status_post("Nuova striscia",media_ids=new_strip)
  18. else:
  19. print("error creating image\n")
  20. print(status)