Python scripts to gather github statistics.
In order to run the scripts, we need to install dependecies and list the usernames we'll be analysing.
Run the following command on your terminal:
pip install -r requirements.txt
In order authenticate the API requests, we must first generate a Github personal token,
containing the read:user
scope.
Then we just set the GITHUB_TOKEN
environment variable:
GITHUB_TOKEN=<token>
or in fish:
set -x GITHUB_TOKEN "<token>"
There are two different ways to determine what users we will be scraping:
usernames.txt
is a text file listing github usernames we are interested in gathering statistics from.
It should have one username per line, for example:
fredericojordan
gvanrossum
If a usernames.txt
file is not found, the second option is using a GITHUB_USERNAMES
env var.
The usernames are separated by a comma, for example (in bash):
GITHUB_USERNAMES="fredericojordan,gvanrossum"
or in fish:
set -x GITHUB_USERNAMES "fredericojordan,gvanrossum"
Simply run the stats.py
script from your terminal:
python stats.py
Output:
1. (2855) fredericojordan
2. (1040) gvanrossum
We may also use gunicorn
to serve a simple static web page displaying the statistics:
gunicorn server:app
and then navigate to localhost:8000 on a browser of your choice.