Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import httplib
- url = "http://webscraper.io/"
- if 'http' in url:
- url = url.replace('http://', '').strip()
- conn = httplib.HTTPConnection(url)
- conn.request("GET",'')
- r1 = conn.getresponse()
- print 'r1.Status code=', r1.status
- Traceback (most recent call last):
- File "TestSatusline.py", line 23, in <module>
- conn.request("GET",'')
- File "/usr/lib/python2.7/httplib.py", line 1017, in request
- self._send_request(method, url, body, headers)
- File "/usr/lib/python2.7/httplib.py", line 1051, in _send_request
- self.endheaders(body)
- File "/usr/lib/python2.7/httplib.py", line 1013, in endheaders
- self._send_output(message_body)
- File "/usr/lib/python2.7/httplib.py", line 864, in _send_output
- self.send(msg)
- File "/usr/lib/python2.7/httplib.py", line 826, in send
- self.connect()
- File "/usr/lib/python2.7/httplib.py", line 807, in connect
- self.timeout, self.source_address)
- File "/usr/lib/python2.7/socket.py", line 553, in create_connection
- for res in getaddrinfo(host, port, 0, SOCK_STREAM):
- socket.gaierror: [Errno -2] Name or service not known
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement