md2notion icon indicating copy to clipboard operation
md2notion copied to clipboard

HTTPError - Invalid Input

Open ThisIsNoahEvans opened this issue 2 years ago • 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/[email protected]/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/[email protected]/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 :)

ThisIsNoahEvans avatar Jul 21 '21 14:07 ThisIsNoahEvans

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

https://github.com/jamalex/notion-py/issues/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/

Cobertos avatar Jul 21 '21 19:07 Cobertos

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

laoby avatar Aug 24 '21 00:08 laoby

I have to update the dependencies to rely on the fork. Haven't put in that work yet.

On Mon, Aug 23, 2021, 8:46 PM AngelaERP @.***> wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Cobertos/md2notion/issues/40#issuecomment-904232381, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSGCDOEHGW7MNOKEN2MMDT6LTVRANCNFSM5AYCDABQ .

Cobertos avatar Aug 24 '21 03:08 Cobertos

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

five-five0909 avatar Jun 26 '22 08:06 five-five0909

Is that fixed? maybe time to update the dependencies?

gadelkareem avatar Sep 27 '22 21:09 gadelkareem

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

j717273419 avatar Mar 09 '23 03:03 j717273419