Last active
August 16, 2023 19:40
-
-
Save elijahbenizzy/31f699a152e26847a94c25f1561a35f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def star_count(starcount_url: str, github_api_key: str) -> Tuple[str, int]: | |
"""Generates the star count for a given repo. | |
:param starcount_url: URL of the repo | |
:param github_api_key: API key for GitHub | |
:return: A tuple of the repo name and the star count | |
""" | |
response = requests.get( | |
starcount_url, headers={"Authorization": f"token {github_api_key}"} | |
) | |
response.raise_for_status() # Raise an exception for unsuccessful requests | |
data = response.json() | |
return data["full_name"], data["stargazers_count"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment