-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathejercicioAPI2.py
More file actions
41 lines (26 loc) · 803 Bytes
/
ejercicioAPI2.py
File metadata and controls
41 lines (26 loc) · 803 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
30
31
32
33
34
35
36
37
38
39
40
41
import requests
def tomaAutores():
BASE_URL = "https://goodreads-devf-aaron.herokuapp.com"
URI = "/api/v1/authors/"
URL = BASE_URL + URI
response = requests.get(URL)
diccionario = response.json()
resultado = diccionario[0]['name']
for i in range(0, len(diccionario)):
print (diccionario[i]['name'], diccionario[i]['last_name'])
print (diccionario[i]['biography'])
print ('------------------------------------------------')
return resultado
x = tomaAutores()
print(x)
'''
def tomaAutores():
BASE_URL = "https://goodreads-devf-aaron.herokuapp.com"
URI = "/api/v1/authors/"
URL = BASE_URL + URI
response = requests.get(URL)
lista_jsons = response.json()
for i in lista_jsons:
print(i)
tomaAutores()
'''