Update requests exercise

This commit is contained in:
2024-01-14 00:15:52 +01:00
parent 17d758d75b
commit 72ccded05d
12 changed files with 195 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env python3
import requests
try:
response = requests.get('https://google.ese', timeout=1)
response.raise_for_status()
except requests.Timeout:
print(f"\n[!] La web ha excedido el límite de tiempo de espera")
except requests.HTTPError as http_err:
print(f"[!] Error HTTP: {http_err}")
except requests.RequestException as err:
print(f"\n[!] Error: {err}")
else:
print(f"\n[+] No ha habido ningún error en la solicitud")