A Mastodon bot to drip-toot a Piwigo gallery one image at a time.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

register.py 999B

123456789101112131415161718192021222324
  1. from mastodon import Mastodon
  2. import config
  3. def register_app():
  4. Mastodon.create_app(
  5. config.APP_NAME,
  6. website=config.APP_WEBSITE,
  7. api_base_url=config.APP_INSTANCE_URL,
  8. to_file='secrets.txt')
  9. app = Mastodon(client_id='secrets.txt')
  10. print("Browse to the OAuth authorization page at")
  11. print(app.auth_request_url())
  12. app.log_in(
  13. code=input("and paste here the OAuth authorization code: "),
  14. to_file='secrets.txt')
  15. print("Registration complete")
  16. if __name__=='__main__':
  17. print("""
  18. This utility should only be run *once* (if you see the file "secrets.txt", you probably shouldn't run this).
  19. You should also make sure that you've edited "config.py" with the relevant APP_INSTANCE_URL etc.,
  20. and that you don't violate the instance's code of conduct by running your bot (ask an admin if unsure).""")
  21. input("Hit enter if you're ready to register your app with your mastodon server, otherwise — hit Ctrl-C ")
  22. register_app()