获取github存储库的web流量统计信息。
github-traffic-stats的Python项目详细描述
获取github存储库的web流量统计信息。
python cli
python cli工具,使用 Github API。
一些用例来说明为什么这可能有用。
- 检查所有回购协议的流量。突然监视 兴趣或任何一般模式的高峰。
- 存储流量统计数据以备将来参考。
- 检查代码克隆的频率。
安装
pip install github_traffic_stats
依赖关系
通过运行以下命令安装需求:
pip install -r requirements.txt
对于python和其他 语言,尽管它们可能不支持存储库流量api (2016年8月15日公布)。
用法
usage: gts [-h] username [repo] [save_csv] [-o] or: usage: gts [-h] username:password [repo] [save_csv] [-o] positional arguments: username Github username password Github password for 'username', or access token repo User's repo save_csv Set to "no_csv" if no CSV should be saved optional arguments: -h, --help show this help message and exit -o, --organization specify Github organization if different from username
关于Github Access Tokens的信息。
运行
使用python或python3在命令行上运行。
$ gts 'nchah' 'github-traffic-stats' 'save_csv' Password:* (passwords are hidden) > github-traffic-stats - Visitors Date Views Unique visitors Totals 125 36 2017-07-16 1 1 2017-07-17 10 2 2017-07-19 11 4 2017-07-20 12 5 2017-07-21 3 3 2017-07-22 1 1 2017-07-23 1 1 2017-07-24 17 6 2017-07-25 32 5 2017-07-26 1 1 2017-07-27 1 1 2017-07-28 6 4 2017-07-29 26 5 2017-07-30 3 1 > github-traffic-stats - Git clones Date Clones Unique cloners Totals 5 5 2017-07-17 1 1 2017-07-24 2 2 2017-07-26 1 1 2017-07-29 1 1 > github-traffic-stats - Referring sites Date Views Unique visitors Totals 44 27 Google 33 24 github.c... 11 3 $ # Or to get stats on all of your repositories $ gts 'nchah' 'ALL' 'save_csv' Password:* (passwords are hidden) $ # Or if you are running on an organization repo (for example NREL's SAM repo) as a user with access $ gts 'nickdiorio' 'SAM' 'save_csv' -o 'NREL' Password:* (passwords are hidden) ...
存储在csv文件中的流量数据,列:
repository_name, date, views, unique_visitors
为脚本的每次运行创建单独的csv。
要合并并仅保留唯一的数据点,请运行:
$ bash bash/merge-csv.sh [folder_with_CSVs]