forked from jennielees/oh-no-broken-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.py
More file actions
27 lines (18 loc) · 783 Bytes
/
github.py
File metadata and controls
27 lines (18 loc) · 783 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
26
27
# I'm so close with this one.. I've got it to print out some stuff I got
# from the GitHub API, but not what I want!
# I saved the API stuff in a file to save time! :-)
import json
def github_api_response():
with open('github.json') as f:
github = json.loads(f.read())
return github
def print_user_repository_names():
# I just want to print out the names and descriptions of the repositories..
# like 'Hackbright-Curriculum: Exercises for the Hackbright Academy Fellowship Program'
repos = github_api_response()
for repo in repos:
# I don't think I have these keys right
# Also I'd like to print it on one line.
print repo['name'] + ": " + repo['description']
if __name__=="__main__":
print_user_repository_names()