Last active
October 2, 2018 18:33
-
-
Save ekollof/47e3f3f54f2aee5ab1b512d6222bf292 to your computer and use it in GitHub Desktop.
Example getting stats from mastodon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.7 | |
import sys | |
from mastodon import Mastodon | |
from pprint import pprint | |
from urllib.parse import urlparse | |
def main(): | |
host = urlparse(sys.argv[1]) | |
Mastodon.create_app( | |
'maststats', | |
api_base_url = sys.argv[1], | |
to_file = f"{host.netloc}.secret" | |
) | |
mastodon = Mastodon( | |
client_id = f'{host.netloc}.secret', | |
api_base_url = sys.argv[1] | |
) | |
instance = mastodon.instance() | |
pprint(instance) | |
activity = mastodon.instance_activity()[0] | |
pprint(activity) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Against a bigger instance ;)