-
-
Save KyMidd/875d7f3a8747037c9ff67106112cc278 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Define function | |
| def get_repo_dependencies(repo, index, repo_count): | |
| # Check rate limit | |
| hold_until_rate_limit_success() | |
| # URL | |
| url = "https://api.github.com/repos/"+GITHUB_ORG+"/"+repo+"/dependency-graph/sbom" | |
| # Fetch sbom | |
| response = requests.get( | |
| url=url, | |
| headers=headers | |
| ) | |
| # Check response code, and if not 200, exit | |
| if response.status_code == 200: | |
| # Print green check box | |
| print("✅ Successfully fetched SBOM for repo", repo, "("+str(index)+"/"+str(repo_count)+")") | |
| else: | |
| print("❌ Error fetching SBOM for repo", repo, "("+str(index)+"/"+str(repo_count)+")") | |
| # Print error message | |
| print("Error message:", response.json()['message']) | |
| return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment