Skip to content

Instantly share code, notes, and snippets.

@po5i
Created July 1, 2022 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save po5i/a1c4719ec9cae3a2977fd09a9593d0e4 to your computer and use it in GitHub Desktop.
Save po5i/a1c4719ec9cae3a2977fd09a9593d0e4 to your computer and use it in GitHub Desktop.
Print the list of repos for a specific user
import requests
BASE_URL = "https://api.github.com/users/{}/repos"
def get_repos(username: str) -> None:
response = requests.get(BASE_URL.format(username))
try:
print(f"Repositories from {username}:")
print([repo["name"] for repo in response.json()])
except Exception as e:
print(f"Error: {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment