This repository was archived by the owner on Jul 5, 2023. It is now read-only.
File tree 3 files changed +5
-6
lines changed
3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 40
40
41
41
- name : Generate statistics
42
42
id : statistics
43
- continue-on-error : true
44
43
run : |
45
44
python -m venv venv
46
45
source venv/bin/activate
51
50
52
51
- name : Commit the statistics
53
52
uses : stefanzweifel/git-auto-commit-action@v4
54
- if : steps.statistics.outcome == 'success'
55
53
with :
56
54
commit_message : Update ${{ env.stats_json }}
57
55
commit_options : ' --no-verify --signoff'
Original file line number Diff line number Diff line change 3
3
from datetime import date
4
4
5
5
import condastats .cli
6
- import requests
6
+ from github import Github
7
7
8
8
9
9
def _write_archive (archive_path , download_count ):
@@ -49,8 +49,9 @@ def pypi_count(package, archive_pypi):
49
49
50
50
def github_count (user , package , archive_github ):
51
51
"""Download count through the GitHub repository."""
52
- r = requests .get (f'https://api.github.com/repos/{ user } /{ package } /releases' )
53
- download_count = sum (sum (map (lambda d : d ['download_count' ], release ['assets' ])) for release in r .json ())
52
+ gh = Github ()
53
+ repo = gh .get_repo (f"{ user } /{ package } " )
54
+ download_count = sum (sum (map (lambda d : d .download_count , release .get_assets ())) for release in repo .get_releases ())
54
55
_write_archive (archive_github , download_count )
55
56
return download_count
56
57
Original file line number Diff line number Diff line change 1
1
condastats == 0.2.1
2
- requests == 2.28.1
2
+ PyGithub == 1.57
You can’t perform that action at this time.
0 commit comments