0

I am using python 3.4 and my task is to download link from a website. But while fetching the data I got an error that:

I have tried it from both httplib2 and urllib, but in both cases it is showing the same error.

OUTPUT:

>>> import urllib.request
>>> request = urllib.request.Request(url)
>>> response = urllib.request.urlopen(request)

    Traceback (most recent call last):
File "C:\Python34\lib\urllib\request.py", line 1183, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
 File "C:\Python34\lib\http\client.py", line 1137, in request
    self._send_request(method, url, body, headers)
  File "C:\Python34\lib\http\client.py", line 1182, in _send_request
    self.endheaders(body)
  File "C:\Python34\lib\http\client.py", line 1133, in endheaders
    self._send_output(message_body)
  File "C:\Python34\lib\http\client.py", line 963, in _send_output
    self.send(msg)
  File "C:\Python34\lib\http\client.py", line 898, in send
    self.connect()`
  File "C:\Python34\lib\http\client.py", line 871, in connect
    self.timeout, self.source_address)`
  File "C:\Python34\lib\socket.py", line 516, in create_connection
    raise err
  File "C:\Python34\lib\socket.py", line 507, in create_connection
   sock.connect(sa) 

TimeoutError: [WinError 10060] A connection attempt failed because the    
connected party did not properly respond after a period of time, or     
established connection failed because connected host has failed to respond
DeepSpace
  • 78,697
  • 11
  • 109
  • 154
Faisal Jaffri
  • 37
  • 1
  • 12

0 Answers0