通过在标头中传递访问权限和密钥进行API身份验证时出错

2024-06-08 23:06:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用API密钥和密码进行身份验证,但它显示403错误。下面是代码

headers = {'X-API-KEY': 'someapikey', 'X-API-SECRET': 'somesecretkey'}
url="http://ops.epo.org/rest-services/publisheddata/publication/epodoc/EP1000000/fulltext"
r = requests.get(url, headers=headers)

错误消息是:

b'<error><code>403</code><message>This request has been rejected due to the
 violation of Fair Use policy</message><moreInfo>http://www.epo.org/searching
/free/espacenet/fair-use.html</moreInfo>\n\t\t\t\t</error>\n\t\t\t'

请帮忙


Tags: 代码org身份验证apihttpurl密码message
1条回答
网友
1楼 · 发布于 2024-06-08 23:06:32

你的头没有问题,你发送了太多的请求,并且得到了临时禁令。您必须等待一段时间,然后再试一次。合理使用政策的正确链接是https://www.epo.org/service-support/ordering/fair-use.html

读取“自动查询”部分,并考虑在脚本中添加一些节流。

相关问题 更多 >