User statistics bot for Mastodon
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 7 commits ahead, 2 commits behind josefkenny:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Mastodon User Count Bot

A bot which counts users from all instances listed at [] then posts statistics to Mastodon.

My copy is currently running at

This is a variation of the bot by @josefkenny:


  • Python 2
  • gnuplot version 5 or greater
  • pip install
  • Everything else at the top of!


  1. Edit config.txt to specify the hostname of the Mastodon instance you would like to get data from.
  2. Create a file called secrets.txt in the folder secrets/, as follows:
uc_client_id: <your client ID>
uc_client_secret: <your client secret>
uc_access_token: <your access token>

To get these values, create an account for your bot, then run this script:

from mastodon import Mastodon

# change this to the apprpriate instance, login and username
instance_url = ""
user_name = ""
user_password = "123456"

Mastodon.create_app("My User Count", scopes=["read","write"],
   to_file="clientcred.txt", api_base_url=instance_url)

mastodon = Mastodon(client_id = "clientcred.txt", api_base_url = instance_url)
   scopes = ["read", "write"],
   to_file = "usercred.txt"

Your client id and secret are the two lines in clientcred.txt, your access token is the line in usercred.txt. (Yeah, I know I should have automated this step -- but hey, the above script is better than having to figure it out by yourself! ;) )

  1. Use your favourite scheduling method to set ./ to run regularly.

Call the script with the --no-upload argument if you don't want to upload anything.

Note: The script will fail to output a graph until you've collected data points that are actually different!