首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用api从概念中获取页面标题

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

Stack Overflow用户
提问于 2021-03-07 04:29:00
回答 2查看 3K关注 0票数 2

我正在使用notion.py,我刚开始使用python,我想从页面中获得一个页面标题,并将它发布到另一个页面中,但是当我尝试时,我会得到一个错误

代码语言:javascript
复制
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.

我的代码是我用的是

代码语言:javascript
复制
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)
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-03-09 12:24:35

您可以找到修复这里

简而言之,您需要修改库本身中的两个文件:

  1. store.py
  2. client.py

找到“限制”值,并将其更改为100。

票数 2
EN

Stack Overflow用户

发布于 2021-09-02 06:12:48

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

Fix PR 294已于2021年3月6日开放,尚未合并。

要解决GitHub上当前打开的PR (拉请求)的问题,请执行以下操作:

pip uninstall notion

然后要么:

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

requirements.txt添加中

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

PR 294 fix的来源

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66513210

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档