-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget-img.py
More file actions
29 lines (20 loc) · 793 Bytes
/
get-img.py
File metadata and controls
29 lines (20 loc) · 793 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
28
29
import json, requests
with open("token.txt") as f:
token = f.readline().strip()
def updateperson(person):
if not person["github"]:
person["github"] = "olinjs"
userdata = requests.get("https://api.github.com/users/"+person["github"], auth=(token, "")).json()
print person["name"]
person["image"] = userdata["avatar_url"]
person["githuburl"] = "http://www.github.com/"+person["github"]
return person
##
with open("./content/input.json") as jsonfile:
index = json.load(jsonfile)
index["teachers"] = map(updateperson, index["teachers"])
index["ninjas"] = map(updateperson, index["ninjas"])
index["students"] = map(updateperson, index["students"])
print "Done!"
with open("./content/index.json", "w") as jsonfile:
json.dump(index, jsonfile, indent=4, separators=(',', ': '))