toot.py 434 B

123456789101112131415
  1. #!/usr/bin/env python3
  2. # usage: toot.py domain.name email .client .user image.png
  3. import sys
  4. from mastodon import Mastodon
  5. mastodon = Mastodon(
  6. client_id = sys.argv[2],
  7. access_token = sys.argv[3],
  8. api_base_url = 'https://' + sys.argv[1]
  9. )
  10. pic = mastodon.media_post(sys.argv[4], description='a small automatically-generated black and white image')
  11. mastodon.status_post(sys.argv[5], visibility="public", media_ids=[pic])