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
4
  • Can you access the website via your browser?
    – DeepSpace
    Jul 5, 2016 at 7:33
  • Possible duplicate of Python: URLError: <urlopen error [Errno 10060]
    – Destrif
    Jul 5, 2016 at 7:36
  • @DeepSpace yes i can access the website, actually i am accesing it from my office network. Is this the reason i am getting such error? Jul 5, 2016 at 7:41
  • @Destrrif can you tell me how to setup proxy environment for it Jul 5, 2016 at 7:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.