forked from pythonprobr/libpythonpro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_api.py
More file actions
18 lines (13 loc) · 413 Bytes
/
github_api.py
File metadata and controls
18 lines (13 loc) · 413 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import requests
def buscar_avatar(usuario):
"""
Busca o avatar de um usuário no Github
:param usuario: str com o nome de usuário no github
:return: str com o link do avatar
"""
url = f'https://api.github.com/users/{usuario}'
resp = requests.get(url)
print(resp.status_code)
return resp.json()['avatar_url']
if __name__ == '__main__':
print(buscar_avatar('sambiase'))