Cobertos/md2notion

HTTPError - Invalid Input

ThisIsNoahEvans opened this issue · 6 comments

Hi, I keep getting this error when running this program. Through a Python file and the cli.

noah@Noahs-MBP ~ % python3 -m md2notion "***" "https://www.notion.so/***/Test-***" "/Users/noah/Documents/test.md" 
Initializing Notion.so client...
Getting target PageBlock...
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/homebrew/lib/python3.9/site-packages/md2notion/__main__.py", line 5, in <module>
    cli(sys.argv[1:])
  File "/opt/homebrew/lib/python3.9/site-packages/md2notion/upload.py", line 199, in cli
    page = client.get_block(args.page_url)
  File "/opt/homebrew/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 "/opt/homebrew/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 "/opt/homebrew/lib/python3.9/site-packages/notion/store.py", line 184, in get
    self.call_load_page_chunk(id)
  File "/opt/homebrew/lib/python3.9/site-packages/notion/store.py", line 286, in call_load_page_chunk
    recordmap = self._client.post("loadPageChunk", data).json()["recordMap"]
  File "/opt/homebrew/lib/python3.9/site-packages/notion/client.py", line 260, in post
    raise HTTPError(
requests.exceptions.HTTPError: Invalid input.

Any reason for this? Thanks :)

Yeah, this is an upstream issue w/ notion-py that affects a lot of stuff.

jamalex/notion-py#305

I made a fork with the PR that fixes, I have yet to replace notion-py with it in this repo.

https://pypi.org/project/notion-cobertos-fork/

laoby commented

I do like this:
pip install notion-cobertos-fork,but had other problem,
then do
pip uninstall notion-cobertos-fork and then pip install notion-cobertos-fork

Hello, I am a novice, now I also encounter this problem, always fail, do you have a complete solution, because I really can not understand what everyone said, sorry for bothering you

Is that fixed? maybe time to update the dependencies?

TKS! IT worked for me.
@Cobertos

First , you should install notion-cobertos-fork package.

  1. pip install notion-cobertos-fork

then, excute your last command

  1. python -m md2notion [token_v2] [page-url] […markdown_path_glob_or_url]

eg.
python -m md2notion v02%3Auser_token_or_cookies%3xxxxxxxx https://www.notion.so/wangdongjie/xxxxxxxx?v=9e8d348e269341e8b19656a01a858a82 C:\Users\xxx\Documents\ks\youdaonote-pull\export\Ideas*md