jamalex / notion-py

Unofficial Python API client for Notion.so
MIT License
4.3k stars 475 forks source link

requests.exceptions.HTTPError: Invalid input. #343

Closed 7k50 closed 3 years ago

7k50 commented 3 years ago

I am trying out notion-py for the first time, but actually can't get it to run the Quickstart example.

I installed for Pyton 3.9 via pip install notion with version 0.0.28.

from notion.block import TweetBlock
client = NotionClient(token_v2="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
page = client.get_block("https://www.notion.so/myorg/Test-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
print("The old title is:", page.title)

Gives:

Traceback (most recent call last):
  File "…/test_notion-py.py", line 35, in <module>
    page = client.get_block("https://www.notion.so/myorg/Test-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
  File "…/lib/python3.9/site-packages/notion/client.py", line 169, in get_block
    block = self.get_record_data("block", block_id, force_refresh=force_refresh)
  File "…/lib/python3.9/site-packages/notion/client.py", line 162, in get_record_data
    return self._store.get(table, id, force_refresh=force_refresh)
  File "…/lib/python3.9/site-packages/notion/store.py", line 184, in get
    self.call_load_page_chunk(id)
  File "…/lib/python3.9/site-packages/notion/store.py", line 286, in call_load_page_chunk
    recordmap = self._client.post("loadPageChunk", data).json()["recordMap"]
  File "…/lib/python3.9/site-packages/notion/client.py", line 260, in post
    raise HTTPError(
requests.exceptions.HTTPError: Invalid input.
felipehlvo commented 3 years ago

I have the same issue

7k50 commented 3 years ago

This is apparently a known issue that has a "fix". I don't know if the fix is temporary or permanent. It hasn't been merged into the main release yet.

See: https://github.com/jamalex/notion-py/pull/294#issuecomment-804306525

Quick solution

Uninstall current version if required:

pip uninstall notion

Then:

pip install git+https://github.com/jamalex/notion-py.git@refs/pull/294/merge

OR add into requirements.txt:

git+https://github.com/jamalex/notion-py.git@refs/pull/294/merge

annahung31 commented 3 years ago

Hi, I've already reinstalled notion with pip install git+https://github.com/jamalex/notion-py.git@refs/pull/294/merge, but I still faced the same error. Is there any other way to solve this? Thanks!

JustDhan commented 3 years ago

Same error from this morning Hi, like the guy above, i've reinstalled that merge but the code is stopping right on the requests done for the method default_query, any suggest?

kir-lys commented 3 years ago

I still have the same problem too after reinstalled notion with pip install git+https://github.com/jamalex/notion-py.git@refs/pull/294/merge

dazaooo commented 2 years ago

i slove this problem

pip uninstall notion

pip install git+https://github.com/jamalex/notion-py.git@refs/pull/294/merge