INNER CODE UNIT · Python
get_repo_info
timschneeb/awesome-shizuku · scripts/check_links.py:70
def get_repo_info(repo_path, token):
"""
Fetches repository information from the GitHub API.
Returns a dictionary with repo info, or None on error.
"""
api_url = f"https://api.github.com/repos/{repo_path}"
headers = {"Accept": "application/vnd.github.v3+json"}
if token:
headers["Authorization"] = f"token {token}"
try:
response = requests.get(api_url, headers=headers)
# Check for rate limiting
if response.status_code == 403 and 'rate limit' in response.text.lower():
print("GitHub API rate limit exceeded. Please try again later or use a GITHUB_TOKEN.")
return None