-
Notifications
You must be signed in to change notification settings - Fork 481
400 error on get_block() call #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems that the Notion API has changed and a large limit get 400 error now. |
@nissy131 Ok so I need to do like |
I think you should do this in source Line 280 in c9223c0
|
Was just about to edit my reply. Probably could create a PR out of this. Is 100 the highest? |
Should this be a hard coded value or should there be a way to adjust early on in a program? And thanks for figuring this out. I hit the same thing with something that worked a few hours ago was no longer working. |
I agree with this and also think that there is going to be a need for pagination as well since some things might have more than 100 blocks. |
In my case...
|
Feel free to use #293 as a workaround for now. |
The very hot, hot-fix based on #293 |
@ttran that did the trick, thank you! |
FYI, the API has been also changed so that requesting loadPageChunk multiple times will result in a 429 error(Too Many Requests). |
Hi all! hope you are having a great day! We encounter this problem also and its very urgent for us to solve this. We were waiting a few days checking this thread expecting a new library version with this issue solved but it seems its still open. How can we implement this workarround? We are using the library version 0.0.28. I'll be honest, I dont know where to put this code. Thanks for any help you can give us. |
I got this error only on my second call to get_block() in the snipped below but, oddly, no error if I move this second call further down in my code. Doesn't work ('HTTPError: Invalid Input' on second line) reading_page_block = client.get_block(cfg['reading'])
reading_log = client.get_block(READING_LOG_ID) # child to reading_page_block When I log the requests I see:
But I don't have this issue when I run reading_page_block = client.get_block(cfg['reading'])
books = {
'name': [],
'identifier': [],
'pages_read': [],
'timestamp': []
}
timestamp = datetime.now()
# for each book or article, capture the desired fields
for block in reading_page_block.children:
if block.id not in [ARTICLES_ID, BOOKS_ID]:
continue
else:
for row_block in block.collection.get_rows():
if row_block.title:
books['name'].append(row_block.title)
try:
books['pages_read'].append(row_block.page_number or 0)
except AttributeError:
# articles don't have the pages_read property
if row_block.status and row_block.status.lower()=="read":
books['pages_read'].append(1)
else:
books['pages_read'].append(0)
books['identifier'].append(row_block.id)
books['timestamp'].append(timestamp)
reading_log = client.get_block(READING_LOG_ID) # child to reading_page_block Maybe I should also note that I'll get the same error upon entering the for loop above if I use a subclass of NotionClient with a modified constructor that just sets self.session to enable logging to stdout - I find this behavior strange as well. I'll attach this for good measure. |
When I am making a
client.get_block(full_url)
call, I am getting the below:I didn't change anything in my code and this just started to happen. I suspected it was a token_V2 problem but just checked and it isn't. I saw #11 from back then and looks like there might be an API structural change.
Would love to hear all of your thoughts! Trying to get this resolved because a product of mine depends on this! Thank you!
The text was updated successfully, but these errors were encountered: