This is a very simple example of httplib in Python. I am trying to write a very simple client which can simply ping a URL.
myURL = raw_input('\nURL Please: \n> ')
if myURL == '':
print '\URL Please: \n'
httpconnection = httplib.HTTPConnection(myURL)
res = httpconnection.getresponse()
#I am only interested in 200 OK response, anything else can be ignored
if res.status != 200:
print 'Errr!!!!', myURL, 'seems to be a troublesome URL. The "Internet" says "', res.reason, '" and the status was', res.status, '. Try again.'
data = res.read()
allheaders = res.getheaders()