【发布时间】:2021-08-23 11:48:28
【问题描述】:
我有一些 Python 代码使用 notion-client library 检索 Notion 数据库中的行。该代码确实设法检索所有行,但顺序错误。我查看了 API 参考中的Sort object,但无法弄清楚如何使用它以它们在 notion.so 上显示的确切顺序返回行。这是有问题的sn-p:
from notion_client import Client
notion = Client(auth=NOTION_API_TOKEN)
result = notion.databases.query(database_id='...')
for row in result['results']:
title = row['properties']['NAME_OF_PROPERTY']['title']
if len(title) == 0:
print('')
else:
print(title[0]['plain_text'])
我错过了什么?
【问题讨论】:
标签: python notion-api