I’m learning Python and trying to use the notion.py library. My goal is to fetch a page title from one Notion page and add it to another. But I’m running into an error when I try to do this.
When I run this, I get an error saying ‘Invalid input’. The full error message is pretty long, but it looks like it’s happening when the code tries to load the page chunk.
Any ideas on what I might be doing wrong? I’m new to this, so I’m not sure if I’m missing something obvious. Thanks for any help!
I encountered a similar issue when I first started working with the Notion API. The problem is likely in how you’re using the get_block method. It expects a block ID, not a URL. To fix this, you need to extract the ID from your page URL.
This should resolve the ‘Invalid input’ error. If you’re still having trouble, double-check your token and make sure you have the necessary permissions for both pages.
I’ve been working with the Notion API for a while now, and I can relate to your frustration. One thing I’ve learned is that the ‘notion.py’ library can be a bit tricky, especially for beginners. Have you considered using the official Notion API instead? It’s more straightforward and well-documented.
If you want to stick with ‘notion.py’, make sure you’re using the block ID, not the full URL. The block ID is usually the last part of the URL after the final dash. Also, double-check your token - sometimes permissions can be the culprit.
Another tip: print out the full error message and Google it. Often, someone else has encountered the same issue and posted a solution online. Stack Overflow can be a goldmine for these kinds of problems.
Lastly, don’t get discouraged. API integrations can be challenging, but they’re great for learning. Keep at it, and you’ll get there!
hey, i had a similar problem. make sure ur using the block ID, not the whole URL. the ID is usually at the end of the URL after the last dash. so if ur URL is like ‘notion.so/mypage/My-Cool-Page-abcd1234’, use ‘abcd1234’ as the ID. that should fix it!