diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2020-07-22 22:41:23 -0700 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2020-07-22 22:41:23 -0700 |
commit | fd0d9897e31a1bbc9c305da642b5974e79cf3c53 (patch) | |
tree | 6408edeaf53f7f6c627c23ceb5e2ee3f4c292b4e /scripts | |
parent | c4a266e82d4322a6551ded66dfc77f4d336ffea6 (diff) | |
download | isort-fd0d9897e31a1bbc9c305da642b5974e79cf3c53.tar.gz |
Update to work via basic authentication
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check_acknowledgments.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/scripts/check_acknowledgments.py b/scripts/check_acknowledgments.py index fdc61606..20f560c1 100755 --- a/scripts/check_acknowledgments.py +++ b/scripts/check_acknowledgments.py @@ -33,29 +33,33 @@ def _user_info(user: Dict[str, str], verbose=False) -> str: @hug.cli() async def main(): + auth = (input("Github Username: "), + getpass()) async with httpx.AsyncClient() as client: page = 0 results = [] - contributors = set() + contributors = [] while not page or len(results) == PER_PAGE: page += 1 - response = await client.get(f"{GITHUB_API_CONTRIBUTORS}?per_page={PER_PAGE}&page{page}") + response = await client.get( + f"{GITHUB_API_CONTRIBUTORS}?per_page={PER_PAGE}&page={page}", + auth=auth + ) results = response.json() - print(results) - contributors.update( + contributors.extend( ( contributor for contributor in results if contributor["type"] == GITHUB_USER_TYPE - and contributer["login"] not in IGNORED_AUTHOR_LOGINS - and f"@{contributor['login']}" not in ACKNOWLEDGEMENTS + and contributor["login"] not in IGNORED_AUTHOR_LOGINS + and f"@{contributor['login'].lower()}" not in ACKNOWLEDGEMENTS ) ) - breakpoint() unacknowledged_users = await asyncio.gather( - (client.get(contributor["url"]).json() for contributor in contributors) + *(client.get(contributor["url"], auth=auth) for contributor in contributors) ) + unacknowledged_users = [request.json() for request in unacknowledged_users] if not unacknowledged_users: sys.exit() |