Skip to content

Commit 8f8d8a7

Browse files
authored
Merge pull request mouredev#3775 from avcenal/main
#20 - Python
2 parents c6ead5d + 1f3c2d4 commit 8f8d8a7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Roadmap/20 - PETICIONES HTTP/python/avcenal.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
url = "https://retosdeprogramacion.com"
1212
response = get(url)
13-
#print(response.content.decode("utf-8").replace(">",">\n")) se podría dar formato a los bytes que recoge la llamada
14-
print(response.content)
13+
if response.status_code == 200:
14+
print(response.text.replace(">",">\n")) #doy formato a la respuesta
15+
else:
16+
print(f"Error, código: {response.status_code}")
1517

1618
"""
1719
* DIFICULTAD EXTRA (opcional):

0 commit comments

Comments
 (0)