git-notion icon indicating copy to clipboard operation
git-notion copied to clipboard

HttpError

Open DavidSongzw opened this issue 4 years ago • 19 comments

  • git-notion version:0.2.4
  • Python version:3.9
  • Operating System:Mac

Description

run git-notion to upload doc

What I Did

export NOTION_TOKEN_V2=xxxxx
export NOTION_ROOT_PAGE="https://www.notion.so/myspace/xxxxx?v=xxxxxx"
export NOTION_IGNORE_REGEX="android/.*|ios/.*|node_modules/.*"
git-notion

Error

running sync
Traceback (most recent call last):
  File "/usr/local/bin/git-notion", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/git_notion/cli.py", line 12, in main
    git_notion.sync_to_notion(path)
  File "/usr/local/lib/python3.9/site-packages/git_notion/git_notion.py", line 63, in sync_to_notion
    root_page = get_client().get_block(root_page_url)
  File "/usr/local/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 "/usr/local/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 "/usr/local/lib/python3.9/site-packages/notion/store.py", line 184, in get
    self.call_load_page_chunk(id)
  File "/usr/local/lib/python3.9/site-packages/notion/store.py", line 286, in call_load_page_chunk
    recordmap = self._client.post("loadPageChunk", data).json()["recordMap"]
  File "/usr/local/lib/python3.9/site-packages/notion/client.py", line 260, in post
    raise HTTPError(
requests.exceptions.HTTPError: Invalid input.

DavidSongzw avatar Oct 05 '21 05:10 DavidSongzw

And my NOTION_ROOT_PAGE link is like "https://www.notion.so/myspace/xxxxx?v=xxxxxx".When it is a full database page, everything is ok. If it is a normal page, the above error occurs.By the way my page is a subpage.

DavidSongzw avatar Oct 05 '21 05:10 DavidSongzw

@DavidSongzw If you submit this as a PR, I will merge this.

NarekA avatar Oct 06 '21 15:10 NarekA

Sorry, I'm not a python programmer,it may be caused by notion-py, You can see his issues.

DavidSongzw avatar Oct 11 '21 03:10 DavidSongzw

I think that's maybe because your page is private @DavidSongzw?

gamcoh avatar Nov 23 '21 15:11 gamcoh

I have the same issue. The workspace is private in deed.

mehdicopter avatar Dec 03 '21 11:12 mehdicopter

Same error here, somehow it worked but no more.

NicolasTobias avatar Feb 04 '22 17:02 NicolasTobias

It seems like you have to you a root page as a sub-page throughs an error. Screen Shot 2022-02-06 at 20 18 50

yechielw avatar Feb 06 '22 18:02 yechielw

@DavidSongzw

yechielw avatar Feb 07 '22 06:02 yechielw

Same error here. Im try in root page and sub-page, both dont work.

afreitasdotdev avatar Mar 30 '22 21:03 afreitasdotdev

I've started getting this issue today, to the same page that worked a few days ago.

olliechick avatar Mar 30 '22 21:03 olliechick

just started using git-notion and having the same error today

Seth-Williams avatar Mar 31 '22 21:03 Seth-Williams

Has there been any movement on this issue? I don't have the option of making a top-level page as it's a large company Notion space. It would need to be a sub-page.

Are there any plans to fix this? Is there any way I can help?

andrewspode avatar May 27 '22 14:05 andrewspode

I've stepped through the code and traced this back to an issue in the underlying Notion API package. It's caused by "limit" being set too high. For some reason the fix hasn't been merged in (I've nudged) but you can fix it yourself by changing the limit in client.py from 10000 to 100.

https://github.com/knightjoel/notion-py/commit/521013095e96a05b80edd3e007c931c78a55ce6b

Hopefully this will be resolved.

andrewspode avatar May 27 '22 15:05 andrewspode

@andrewspode I can update this repo to use your fork of notion-py if that fixes this issue.

NarekA avatar May 27 '22 18:05 NarekA

If someone can verify that this resolves the issue, I can merge it and publish the new version.

NarekA avatar May 27 '22 19:05 NarekA

It's not my fix - it's someone elses, but I did fix it locally by installing that version after I had installed notion-py. I will find some time to test it this week.

andrewspode avatar May 31 '22 10:05 andrewspode

Just tested and at the current latest version doesn't work - still the same error as seen above. However if you go to ~/.local/lib/python3.8/site-packages/notion and manually change client.py and store.py as seen here then it works!

giannissmirnios avatar Jun 30 '22 12:06 giannissmirnios

Does not work.

Christos-Hadjinikolis avatar Aug 01 '22 16:08 Christos-Hadjinikolis

Just tested and at the current latest version doesn't work - still the same error as seen above. However if you go to ~/.local/lib/python3.8/site-packages/notion and manually change client.py and store.py as seen here then it works!

this worked for me as well

FMKerckhof avatar Aug 04 '22 13:08 FMKerckhof