Skip to content

Commit 69999f2

Browse files
authored
Merge pull request mouredev#6477 from annaviper/main
#20 - Python
2 parents fe2e736 + 7a1974c commit 69999f2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import requests
2+
import pandas as pd
3+
4+
BASE_URL = "https://pokeapi.co/api/v2/pokemon/"
5+
r = requests.get(BASE_URL + "jigglypuff")
6+
7+
if str(r.status_code).startswith("2"):
8+
data = r.json()
9+
print(r.text)
10+
else:
11+
raise
12+
13+
print(f"Nombre: {data['name']}")
14+
print(f"ID: {data['id']}")
15+
print(f"Peso: {data['weight']}")
16+
print(f"Altura: {data['height']}")
17+
print(f"Tipo(s): {', '.join([i['type']['name'] for i in data['types']])}")
18+
print(f"Juegos(s): {', '.join([i['version']['name'] for i in data['game_indices']])}")

0 commit comments

Comments
 (0)