forked from tanmaysonar/pro1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-repo.py
More file actions
54 lines (44 loc) · 1.3 KB
/
api-repo.py
File metadata and controls
54 lines (44 loc) · 1.3 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
import requests
import json
# main api url
url = 'https://api.github.com/users/'
# put your username/password here
#auth = ('myUsername', 'myPassword')
# request an authorization token from the server
#response = requests.get(url + '/user/authentication',
# auth=auth, verify=False).json()
# get the token from the response
#token = response['authToken']['token']
# to make an api call using this token,
# add a token parameter to the request
#params = {
# 'token': token,
# 'start': '2014-01-15',
# 'end': '2014-02-01',
# 'geoJSON': 1,
# 'limit': 10
#}
name = raw_input("What is your name? ")
if name != "":
response = requests.get(url + name).json()
else:
print "Please enter a GITHub username."
# response contains the geoJSON object,
# pretty print it to the console
#print json.dumps(response, indent=4)
dic = {}
dic = response
for k,v in dic.iteritems():
print str(k) + ':' + str(v)
if response['login'] != None:
print "+++++++++++++++++++++++++++++++++++++++++"
print "My master's name is "+response['login']
if response['bio'] != None:
print "++++++++++++"
print "And his identity is: "+response['bio']
print "+++++++++++++++++++++++++++++++++++++++++"
else:
print "He is too lazy to write a bio"
else:
print "This is not my master!!!!"