Get traffic of your repository.
GitHub provides traffic data for the last 14 days.
This code can be used to run one time of day or every 14 days to collect the traffic.


Python requirements (GithubAPI):
pip install githubpy


run the python file github_traffic.py
But First set this variables based on your repo:
Example: https://github.com/KIOS-Research/ImportPhotos
repo = ‘ImportPhotos’
org = ‘KIOS-Research’
token = ‘%token%’

Python code:

How to get your token:

Then generate token!

traffic.csv

#Date, Visitors, Views
2019-07-04T00:00:00Z, 7, 15
2019-07-05T00:00:00Z, 13, 93
2019-07-06T00:00:00Z, 6, 7
2019-07-07T00:00:00Z, 10, 55
2019-07-08T00:00:00Z, 16, 321
2019-07-09T00:00:00Z, 18, 282
2019-07-10T00:00:00Z, 11, 171
2019-07-11T00:00:00Z, 10, 145
2019-07-12T00:00:00Z, 15, 182
2019-07-13T00:00:00Z, 8, 18
2019-07-14T00:00:00Z, 5, 14
2019-07-15T00:00:00Z, 3, 85
2019-07-16T00:00:00Z, 10, 242
2019-07-17T00:00:00Z, 15, 314
2019-07-18T00:00:00Z, 15, 248
2019-07-19T00:00:00Z, 14, 66
...

totals.csv

Total visitors: 176
Total views: 2258

Other links:
http://www.somsubhra.com/github-release-stats/
https://github.com/seladb/github-traffic-stats
https://developer.github.com/
https://stackoverflow.com/questions/4338358/github-can-i-see-the-number-of-downloads-for-a-repo


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: