在查询《金融时报》时“已禁止访问此API”

2024-10-01 15:43:18 发布

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

如何通过API获取FT文章?在

在请求了一个密钥之后,我第一次在他们的内容API v2中使用了a python API wrapper。所以我运行了以下内容:

from pyft import FT

ft = FT()
# the id can be pulled from the slug url of an FT.com story
content = ft.get_content("6f2ca3d6-86f5-11e4-982e-00144feabdc0")
print(content)

得到了:

^{pr2}$

所以我按照the official instructions进行操作,但是得到了相同的错误:

enter image description here


Tags: thefromimportapiid内容文章密钥
2条回答

这是因为您的API密钥在标题许可证下,它只允许访问有限的enpoint。因此,您应该考虑购买Datamining License,以便访问更多的enpoint,包括代码中的“getcontent”。查看更多信息:https://developer.ft.com/portal/docs-start-obtain-an-api-key

这应该是《金融时报》的一个错误,因为get_content_通知没有任何问题。在

notification = ft.get_content_notifications("2018-10-10T00:00:00.000Z")
print(notification)

{
"requestUrl": "https://api.ft.com/content/notifications?since=2018-10-10T00%3A00%3A00.000Z",
"notifications": [
    {
        "type": "http://www.ft.com/thing/ThingChangeType/UPDATE",
        "id": "http://www.ft.com/thing/e75d5a6c-b725-11e8-bbc3-ccd7de085ffe",
        "apiUrl": "https://api.ft.com/content/e75d5a6c-b725-11e8-bbc3-ccd7de085ffe"
    }
}

相关问题 更多 >

    热门问题