Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法使用Imdbpy。获取ssl异常_Python_Python 3.x_Ssl_Imdb_Imdbpy - Fatal编程技术网

Python 无法使用Imdbpy。获取ssl异常

Python 无法使用Imdbpy。获取ssl异常,python,python-3.x,ssl,imdb,imdbpy,Python,Python 3.x,Ssl,Imdb,Imdbpy,我正在尝试使用IMDbPy,但遇到了SSL错误。我不熟悉imdbpy和python,所以不确定我是否做错了什么。任何帮助都将不胜感激 from imdb import IMDb ia = IMDb(accessSystem='html') dp = ia.get_movie('1431045') print(dp.keys()) 以下是stacktrace: 2018-04-17 20:20:49,830 CRITICAL [imdbpy] /Library/Frameworks/Python

我正在尝试使用IMDbPy,但遇到了SSL错误。我不熟悉imdbpy和python,所以不确定我是否做错了什么。任何帮助都将不胜感激

from imdb import IMDb
ia = IMDb(accessSystem='html')
dp = ia.get_movie('1431045')
print(dp.keys())
以下是stacktrace:

2018-04-17 20:20:49,830 CRITICAL [imdbpy] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/imdb/_exceptions.py:32: IMDbDataAccessError exception raised; args: ({'errcode': 'socket error', 'errmsg': '[Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)', 'original exception': OSError('socket error', OSError('socket error', SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)'))), 'proxy': '', 'url': 'http://www.imdb.com/title/tt1431045/reference', 'exception type': 'IOError'},); kwds: {}
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1693, in open
    return getattr(self, name)(url)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1903, in open_https
    return self._open_generic_http(self._https_connection, url, data)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1852, in _open_generic_http
    http_conn.request("GET", selector, headers=headers)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1107, in request
    self._send_request(method, url, body, headers)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1152, in _send_request
    self.endheaders(body)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1103, in endheaders
    self._send_output(message_body)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1261, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 385, in wrap_socket
    _context=self)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 760, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 996, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 641, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)

我无法用Github的版本复制它;事实上,您的代码要求一个“http”地址,这让我觉得您使用的是旧版本。如果不是这样的话,您是否有最新的系统以及最新的CAs?谢谢您的回复@DavideAlberani。我会跟进你的建议并更新我的系统。我现在禁用了SSL。用我找到的这段代码。try:_create_unverified_https_context=ssl。_create_unverified_context除了AttributeError:#默认情况下不验证https证书的旧式Python传递其他:#处理不支持https验证ssl的目标环境。_create_default_https_context=_创建未验证的https上下文