Dropbox API 文档指出,如果受到速率限制,将返回 503 HTTP 状态代码,并带有“Retry-After” header 。然而,在我怀疑是速率限制的情况下,这是我得到的实际响应:
[503] Error parsing response body or headers: Body - '\r\n<html>\r\n<head><title>Dropbox
- 5xx</title>\r\n<link href="https://www.dropbox.com/static/css/ Headers - {'transfer-
encoding': 'chunked', 'server': 'nginx', 'connection': 'keep-alive', 'cache-control':
'no-cache', 'date': 'Sat, 31 May 2014 12:55:40 GMT', 'content-type': 'text/html'}
(实际上这是dropbox.rest.ErrorResponse as e
的str(e)
)
没有 Retry-After header ,因此这可能不是速率限制的情况。如果是这样的话,那么我不知道这个错误告诉我什么。
有人有我可以测试的实际速率限制响应的示例吗?
最佳答案
该响应仅表明一些随机服务器故障。您应该再次尝试该请求。正如您所指出的,此场景记录在 Core API Reference 的标准 API 错误部分中。 :
503
If the response includes the
Retry-After
header, this means your ... app is being rate limited. Otherwise, this indicates a transient server error, and your app should retry its request.
关于dropbox - 如何处理 Dropbox API 中的速率限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24233673/