Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Last active September 20, 2024 21:16
Show Gist options
  • Select an option

  • Save KyMidd/875d7f3a8747037c9ff67106112cc278 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/875d7f3a8747037c9ff67106112cc278 to your computer and use it in GitHub Desktop.
# 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