Skip to content
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

HTTPError (400) when trying to load a database despite trying proposed solutions #392

Open
evesdropper opened this issue Dec 16, 2023 · 3 comments

Comments

@evesdropper
Copy link

Getting the following error when trying to load a database; I saw #385 #389 with similar issues, but this happens to me when trying to use client.get_collection. I noticed the solution pointed out here; however, I still get the same errors.

Traceback (most recent call last):
  File "/home/revise/Documents/code/strava-notion.py", line 74, in <module>
    update_notion()
  File "/home/revise/Documents/code/strava-notion.py", line 66, in update_notion
    notion_client, cv = get_notion_client()
                        ^^^^^^^^^^^^^^^^^^^
  File "/home/revise/Documents/code/strava-notion.py", line 57, in get_notion_client
    cv = client.get_collection(notion_database)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/revise/Documents/code/lib/python3.11/site-packages/notion/client.py", line 185, in get_collection
    coll = self.get_record_data(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/revise/Documents/code/lib/python3.11/site-packages/notion/client.py", line 162, in get_record_data
    return self._store.get(table, id, force_refresh=force_refresh)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/revise/Documents/code/lib/python3.11/site-packages/notion/store.py", line 186, in get
    self.call_get_record_values(**{table: id})
  File "/home/revise/Documents/code/lib/python3.11/site-packages/notion/store.py", line 254, in call_get_record_values
    results = self._client.post(
              ^^^^^^^^^^^^^^^^^^
  File "/home/revise/Documents/code/lib/python3.11/site-packages/notion/client.py", line 260, in post
    raise HTTPError(
requests.exceptions.HTTPError: Something went wrong. (400)

Are there any other workarounds?

@philippkeller
Copy link

philippkeller commented Dec 23, 2023

I got the same error but I got it working by reducing limits at two places (the solution you linked only had it in one place):

  • Line 280
  • Line 329

After this I was able to both load the collection and also to add records

@philippkeller
Copy link

philippkeller commented Dec 23, 2023

Ah I found out that the code installed by pip is 2 years old.
The newest issues have been fixed in the main branch though.
All my issues were solved once I added this to my requirements.txt:

git+https://github.com/jamalex/notion-py.git

@evesdropper
Copy link
Author

I've tried this multiple times over the last few months, yet it still yields the same HTTPError. I've added git+https://github.com/jamalex/notion-py.git into my requirements.txt (and a quick inspection of store.py verifies that the installation is indeed the correct one), and I'm still running into this problem.

Maybe automating this project wasn't meant to be 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants