-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_data_users_github.py
More file actions
32 lines (20 loc) · 958 Bytes
/
get_data_users_github.py
File metadata and controls
32 lines (20 loc) · 958 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
import requests
from urllib.request import urlopen
from PIL import Image
'''Some app that get requests from api.github.com/users'''
def get_usuario(username):
return requests.get(f'https://api.github.com/users/{username}').json()
def subs(username):
return requests.get(get_usuario(username)['subscriptions_url']).json()
if __name__ == '__main__':
usuario = input('nome de usuario do github: ')
geral = get_usuario(usuario)
info = subs(usuario)
sz_info_subs = list(range(len(info)))
#Screen some main datas from users, setted to pt-BR idiom
print('Nome: {}\nLinkedin: {}\nLocalização: {}\nTwitter: https://twitter.com/{}'.format(geral['name'],geral['blog'], geral['location'], geral['twitter_username']))
for n in sz_info_subs:
tabela = {'Subs':[info[n]['language'], info[n]['name']]}
print(tabela)
#Show user avatar
Image.open(urlopen(get_usuario(usuario)['avatar_url'])).show()