gpt4 book ai didi

python - 无法使用api从概念中获取页面标题

转载 作者:行者123 更新时间:2023-12-02 18:53:00 26 4
gpt4 key购买 nike

我正在使用 notion.py 并且我是 python 新手,我想从页面获取页面标题并将其发布到另一个页面中,但是当我尝试时出现错误

Traceback (most recent call last):
File "auto_notion_read.py", line 16, in <module>
page_read = client.get_block(list_url_read)
File "/home/lotfi/.local/lib/python3.6/site-packages/notion/client.py", line 169, in get_block
block = self.get_record_data("block", block_id, force_refresh=force_refresh)
File "/home/lotfi/.local/lib/python3.6/site-packages/notion/client.py", line 162, in get_record_data
return self._store.get(table, id, force_refresh=force_refresh)
File "/home/lotfi/.local/lib/python3.6/site-packages/notion/store.py", line 184, in get
self.call_load_page_chunk(id)
File "/home/lotfi/.local/lib/python3.6/site-packages/notion/store.py", line 286, in call_load_page_chunk
recordmap = self._client.post("loadPageChunk", data).json()["recordMap"]
File "/home/lotfi/.local/lib/python3.6/site-packages/notion/client.py", line 262, in post
"message", "There was an error (400) submitting the request."
requests.exceptions.HTTPError: Invalid input.

我的代码是我正在使用的是

from notion.client import NotionClient
import time
token_v2 = "my page tocken"
client = NotionClient(token_v2 = token_v2)
list_url_read = 'the url of the page page to read'
page_read = client.get_block(list_url_read)
list_url_post = 'the url of the page'
page_post = client.get_block(list_url_post)
print (page_read.title)

最佳答案

不建议编辑依赖项的源代码,因为将来更新依赖项时肯定会导致冲突。

修复PR 294自2021年3月6日起开放,尚未合并。

要通过 GitHub 上当前打开的 PR(拉取请求)修复此问题,请执行以下操作:

pip 卸载概念

然后:

  1. pip install git+https://github.com/jamalex/notion-py.git@refs/pull/294/merge

在您的requirements.txt中添加

  • git+https://github.com/jamalex/notion-py.git@refs/pull/294/merge
  • Source for PR 294 fix

    关于python - 无法使用api从概念中获取页面标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66513210/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com