The Movie Database 支持

I am attempting to download from the database in bulk and received the following error after several hundred movies:

SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

I could turn off verify for requests , but is there any reason on the API/website side why this would happen?

6 回复(第 1 页,共 1 页)

Jump to last post

but is there any reason on the API/website side why this would happen?

No, but what server is error'ing (is it api.themoviedb.org or image.tmdb.org?) and what's the full error message and request/response headers of a request that is failing?

Should be the api.themoviedb.org. It was suggested to me that has actually something to do with the rate limit, but pasted below is the full error message.

SSLError                                  Traceback (most recent call last)
C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
    594                                                   body=body, headers=headers,
--> 595                                                   chunked=chunked)
    596 

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    351         try:
--> 352             self._validate_conn(conn)
    353         except (SocketTimeout, BaseSSLError) as e:

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in _validate_conn(self, conn)
    830         if not getattr(conn, 'sock', None):  # AppEngine might not have  `.sock`
--> 831             conn.connect()
    832 

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py in connect(self)
    288                                     server_hostname=hostname,
--> 289                                     ssl_version=resolved_ssl_version)
    290 

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir)
    307     if HAS_SNI:  # Platform-specific: OpenSSL with enabled SNI
--> 308         return context.wrap_socket(sock, server_hostname=server_hostname)
    309 

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
    376                          server_hostname=server_hostname,
--> 377                          _context=self)
    378 

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\ssl.py in __init__(self, sock, keyfile, certfile, server_side, cert_reqs, ssl_version, ca_certs, do_handshake_on_connect, family, type, proto, fileno, suppress_ragged_eofs, npn_protocols, ciphers, server_hostname, _context)
    751                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 752                     self.do_handshake()
    753 

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\ssl.py in do_handshake(self, block)
    987                 self.settimeout(None)
--> 988             self._sslobj.do_handshake()
    989         finally:

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\ssl.py in do_handshake(self)
    632         """Start the SSL/TLS handshake."""
--> 633         self._sslobj.do_handshake()
    634         if self.context.check_hostname:

SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

During handling of the above exception, another exception occurred:

SSLError                                  Traceback (most recent call last)
C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    422                     retries=self.max_retries,
--> 423                     timeout=timeout
    424                 )

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
    620             clean_exit = False
--> 621             raise SSLError(e)
    622 

SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

During handling of the above exception, another exception occurred:

SSLError                                  Traceback (most recent call last)
<ipython-input-5-d1af498117a6> in <module>()
     11         url = 'https://api.themoviedb.org/3/movie/{id}?api_key=a792ae6c41aa660a503fb1c835a3daa7&language=en-US'.format(id=i)
     12         payload = "{}"
---> 13         response = requests.request("GET", url, data=payload)
     14         print(response)
     15         if '404' in response:

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\api.py in request(method, url, **kwargs)
     54     # cases, and look like a memory leak in others.
     55     with sessions.Session() as session:
---> 56         return session.request(method=method, url=url, **kwargs)
     57 
     58 

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    473         }
    474         send_kwargs.update(settings)
--> 475         resp = self.send(prep, **send_kwargs)
    476 
    477         return resp

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
    594 
    595         # Send the request
--> 596         r = adapter.send(request, **kwargs)
    597 
    598         # Total elapsed time of the request (approximately)

C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    495         except (_SSLError, _HTTPError) as e:
    496             if isinstance(e, _SSLError):
--> 497                 raise SSLError(e, request=request)
    498             elif isinstance(e, ReadTimeoutError):
    499                 raise ReadTimeout(e, request=request)

SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

Hi there, ya I'm not sure. I don't have any Python experience so I can't really even troubleshoot much of that.

I know our SSL validates properly, you can see that here. There's a number of Python libraries that I know work for a lot of people, you could compare what you're doing with them.

FYI, it does seem to be a rate limiting issue. It triggers the 423 error (though I'm not sure why this is an SSL certificate error). I am going to have to put some form of limitation in.

The only rate limit error we publish is a 429. Is that what you meant? It's still served via the same HTTPS connection though, so if that's what you meant, then perhaps something is being triggered with the HTTP lib you are using.

Yes, I mean 429. I will look into this and post something here for future readers if I can figure it out.

找不到电影或节目?登录并创建它吧。

全站通用

s 聚焦到搜索栏
p 打开个人资料菜单
esc 关闭打开的窗口
? 打开键盘快捷键窗口

在媒体页面

b 返回(或返回上级)
e 进入编辑页面

在电视季页面

(右箭头)下一季
(左箭头)前一季

在电视集页面

(右箭头)下一集
(左箭头)上一集

在所有图像页面

a 打开添加图片窗口

在所有编辑页面

t 打开翻译选择器
ctrl+ s 提交

在讨论页面

n 创建新讨论
w 切换关注状态
p 设为公开 / 私密讨论
c 关闭 / 开放讨论
a 打开活动页
r 回复讨论
l 跳转至最新回复
ctrl+ enter 发送信息
(右箭头)下一页
(左箭头)前一页

设置

想给这个条目评分或将其添加到片单中?

登录

还不是会员?

注册加入社区