Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- def get_http_error_code(url):
- try:
- output = subprocess.check_output(['curl', '-I', '-s', '-o', '/dev/null', '-w', '%{http_code}', url])
- return int(output.strip())
- except subprocess.CalledProcessError as e:
- # Error al ejecutar el comando curl
- print(f"Error: {e}")
- return None
- codes = {
- "200" : "request succeeded.",
- "404" : "not found.",
- "503" : "unavailable."
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement