If you formulated your question correctly, then neither method is perfect.
The big problem is that you said "url", but you only check for the scheme "http". URLs however can have different schemes:
ftp://ftp.funet.fi/pub/standards/RFC/rfc959.txt
file:///home/somesh/.bashrc
"httplib" is not useful for these checks, since it can only handle the "http" scheme. "urllib2" on the other hand can handle all of the schemes I mentioned but the response.code
is not what you have to check. Instead, you should catch exceptions which will be raised when the resource is not available: HTTPError
or URLError
in these cases.