mercredi 22 août 2018

Python check if website exists for a list of websites

I want to check if a website exists, given a list of websites in the format XXXXX.com, where XXXXX=a 5 digit number. So I want to go through from 00000 up to 99999 and see if those variants of the website exist.

I want to do something like

import requests
request = requests.get('http://www.example.com')
if request.status_code == 200:
    print('Web site exists')
else:
    print('Web site does not exist') 

But generate a list of some sort (or even just export a list to csv), so for each URL, i know if it exists or not.

Any advice would be great!




Aucun commentaire:

Enregistrer un commentaire