Test to see if URL exists
Question: What is the best way to test if a URL exists in python, I currently use cURL
however I wanted to switch to use python

In cURL I use something like

    
    
    curl http://www.google.com | tidy -i
    

together with a bash script


Answer: The quickest way is probably something like

    
    
    import httplib
    
    try:
        url = httplib.HTTPConnection('yahoo.com')
        url.connect()
    except httplib.HTTPException as ex:
        print "not connected"
    

