>>> import httplib
>>> conn = httplib.HTTPConnection("www.google.com")
>>> conn.request("HEAD", "/index.html")
>>> res = conn.getresponse()
>>> print res.status, res.reason
200 OK
This code will get the HTTP status code. However, notice that I split up "google.com" and "/index.html" on 2 lines.
And it's confusing.
What if I want to find the status code of just a general URL???
http://mydomain.com/sunny/boo.avi
http://anotherdomain.com/podcast.mp3
http://anotherdomain.com/rss/fee.xml
Can't I just stick the URL into it, and make it work?
Edit...I cannot use urllib, because I don't want to downlaod the file