minwook-shin / notion-database

Python bindings for Notion Database API
https://pypi.org/project/notion-database/
GNU Lesser General Public License v3.0
137 stars 12 forks source link

No results returned with `list_databases()` #4

Closed RickyEsclapon closed 2 years ago

RickyEsclapon commented 2 years ago

Hello! This seems like an awesome package!

Unfortunately I can't seem to get it to work on my end. See screenshot when I follow the example with list_databases():

image

Any thoughts around why I'm not seeing any results returned here? I have plenty of databases in my Notion of course, and you can see if I show the result of D it seems to be a notion_database.database.Database object which seems correct.

I can't seem to get other endpoints like the one to retrieve a specific page to work either. Any guidance you could provide around what I'm missing here?

Thank you! Ricky

minwook-shin commented 2 years ago

@RickyEsclapon hello. thanks for using package!

if results field was empty when call the D.__dict__ code, you have not shared the notion integration with database.

https://developers.notion.com/docs/getting-started#step-2-share-a-database-with-your-integration

D = Database(integrations_token=NOTION_KEY)
D.list_databases(page_size=100)

for i in D.result["results"]:
    database_id = i["id"]
    D.find_all_page(database_id=database_id)
    pprint.pprint(D.result)

pprint.pprint(D.__dict__)

i'm thinking of changing to output value without __dict__. thank you.

RickyEsclapon commented 2 years ago

Perfect, thank you!