Skip to content

Instantly share code, notes, and snippets.

@Aubreymcfato
Created September 4, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aubreymcfato/e88d0813087b116ae0b7 to your computer and use it in GitHub Desktop.
Save Aubreymcfato/e88d0813087b116ae0b7 to your computer and use it in GitHub Desktop.
Script for checking is a URL exists or is a dead link.
import requests
def exists(url):
r = requests.get(url)
print r.status_code
"""
if r.status_code == 200: #requests.codes.ok:
print "daje"
else:
print None
"""
#the list of URLs to check is on a file called prova_url. The file is just a list of urls, in column.
with open('prova_url', 'r') as urls:
for url in urls:
url=url.strip('\n') #prendendo dalla lista, piglia pure il \n
exists(url)
@Aubreymcfato
Copy link
Author

Lo script è semplicissimo, ha solo bisogno in input di un file del tipo

URL1
URL2
URL3
ecc. 

Riproduce una lista di numeri, es.

400
200
200
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment