-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.py
More file actions
32 lines (26 loc) · 1.04 KB
/
Copy pathgithub.py
File metadata and controls
32 lines (26 loc) · 1.04 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
#!/usr/bin/env python
# coding: utf-8
import requests as rq
def getInfo(user):
url = f"https://api.github.com/users/{user}"
userInfo = rq.get(url).json()
ghInfo = {}
shortInfo = {}
if not 'message' in userInfo:
ghInfo['Name'] = userInfo['name']
ghInfo['Login'] = userInfo['login']
ghInfo['Location'] = userInfo['location']
ghInfo['Email'] = userInfo['email']
ghInfo['Company'] = userInfo['company']
ghInfo['Bio'] = userInfo['bio']
ghInfo['Type'] = userInfo['type']
ghInfo['Hireable'] = userInfo['hireable']
ghInfo['Created at'] = userInfo['created_at']
ghInfo['Updated at'] = userInfo['updated_at']
shortInfo['Followers'] = userInfo['followers']
shortInfo['Following'] = userInfo['following']
shortInfo['PublicRepos'] = userInfo['public_repos']
shortInfo['PublicGists'] = userInfo['public_gists']
return ghInfo, shortInfo, userInfo['avatar_url']
else:
return {'Name': "NoInfo"}, {'Rank': 'NoInfo'}, "NoInfo"