-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListUsersRepos.py
More file actions
25 lines (20 loc) · 774 Bytes
/
ListUsersRepos.py
File metadata and controls
25 lines (20 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Prints the name of every public Github repository owned by the specified username
#
import requests
# *** CHANGE THIS FOR DIFFERENT USERNAME ***
username = "nwchinn"
# ******************************************
response = requests.get("https://api.github.com/users/" + username + r"/repos")
# Optional: Prints the status code of the response
# print("status code: ", response.status_code)
repos = response.json()
repo_names = []
for repo in repos:
repo_names.append(repo["name"])
# Grabs name of Github User
response = requests.get("https://api.github.com/users/" + username)
data = response.json()
realname = data["name"]
print("Public Repositories for " + username + "(" + realname + "):")
print("Number of Public Repos: ", data["public_repos"])
print(repo_names)