python image download from url not working (tutorial 22)

0 saumya jariwala · October 22, 2015
Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\urllib\request.py", line 1197, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "C:\Program Files\Python 3.5\lib\http\client.py", line 1030, in request
    self._send_request(method, url, body, headers)
  File "C:\Program Files\Python 3.5\lib\http\client.py", line 1068, in _send_request
    self.endheaders(body)
  File "C:\Program Files\Python 3.5\lib\http\client.py", line 1026, in endheaders
    self._send_output(message_body)
  File "C:\Program Files\Python 3.5\lib\http\client.py", line 866, in _send_output
    self.send(msg)
  File "C:\Program Files\Python 3.5\lib\http\client.py", line 809, in send
    self.connect()
  File "C:\Program Files\Python 3.5\lib\http\client.py", line 1173, in connect
    server_hostname=server_hostname)
  File "C:\Program Files\Python 3.5\lib\ssl.py", line 358, in wrap_socket
    _context=self)
  File "C:\Program Files\Python 3.5\lib\ssl.py", line 729, in __init__
    self.do_handshake()
  File "C:\Program Files\Python 3.5\lib\ssl.py", line 965, in do_handshake
    self._sslobj.do_handshake()
  File "C:\Program Files\Python 3.5\lib\ssl.py", line 610, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Saumya/PycharmProjects/untitled/dl.py", line 8, in <module>
    dl_image("https://ecampus.daiict.ac.in/webapp/intranet/StudentPhotos/201401436.jpg")
  File "C:/Users/Saumya/PycharmProjects/untitled/dl.py", line 6, in dl_image
    urllib.request.urlretrieve(url,name)
  File "C:\Program Files\Python 3.5\lib\urllib\request.py", line 186, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "C:\Program Files\Python 3.5\lib\urllib\request.py", line 161, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Program Files\Python 3.5\lib\urllib\request.py", line 463, in open
    response = self._open(req, data)
  File "C:\Program Files\Python 3.5\lib\urllib\request.py", line 481, in _open
    '_open', req)
  File "C:\Program Files\Python 3.5\lib\urllib\request.py", line 441, in _call_chain
    result = func(*args)
  File "C:\Program Files\Python 3.5\lib\urllib\request.py", line 1240, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "C:\Program Files\Python 3.5\lib\urllib\request.py", line 1199, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)>



Post a Reply

Replies

Oldest  Newest  Rating
0 sfolje 0 · October 22, 2015
Hi, did u try it with any other images?
I think content on website https://ecampus.daiict.ac.in/ is somehow unavailable for security reasons (ssl = security).
  • 1

Python

107,358 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator