Skip to content
This repository has been archived by the owner on Nov 14, 2021. It is now read-only.

HTTPError: invalid input as error Issues #28

Closed
eungbean opened this issue Mar 23, 2021 · 1 comment
Closed

HTTPError: invalid input as error Issues #28

eungbean opened this issue Mar 23, 2021 · 1 comment

Comments

@eungbean
Copy link

재현

client = NotionClient(token_v2=NOTION_TOKEN)
contents_collection = client.get_collection(collection_id=COLLECTION_ID)
posts = contents_collection.get_rows()

for post in posts:
    print(post)

현상

File "get_database_id.py", line 16, in <module>
    posts = contents_collection.get_rows()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notion/collection.py", line 239, in get_rows
    return self.query(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notion/collection.py", line 236, in query
    return CollectionQuery(self, self._get_a_collection_view(), **kwargs).execute()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notion/collection.py", line 230, in _get_a_collection_view
    parent = self.parent
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notion/collection.py", line 224, in parent
    return self._client.get_block(self.get("parent_id"))
  File "/Library/Frameworks/Python.framework/Versions/3.9/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 "/Library/Frameworks/Python.framework/Versions/3.9/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 "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notion/store.py", line 184, in get
    self.call_load_page_chunk(id)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notion/store.py", line 286, in call_load_page_chunk
    recordmap = self._client.post("loadPageChunk", data).json()["recordMap"]
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notion/client.py", line 260, in post
    raise HTTPError(
requests.exceptions.HTTPError: Invalid input.

원인

얼마 전 notion api 의 스펙이 바뀐 듯 합니다.
notion.store.RecordStore.call_load_page_chunk 에서 data 딕셔너리의 limit이 너무 커서 발생하는 에러입니다.
(jamalex/notion-py#301)

해결방법

jamalex/notion-py#294

@younho9 younho9 transferred this issue from narkdown/notion2github Mar 27, 2021
younho9 added a commit that referenced this issue Mar 27, 2021
* chore(deps): Update notion-py dependency

* chore: Use versioned notion2github action
younho9 added a commit that referenced this issue Mar 28, 2021
* feat: Import custom notion-py

* chore(deps): Update requirements.txt
@younho9
Copy link
Member

younho9 commented Mar 28, 2021

안녕하세요. 이슈를 남겨주셔서 감사합니다.

먼저 notion2github에서 narkdown으로 이슈를 이동했습니다.

notion-py에서 해당 문제 관련 PR이 오랜 기간 머지되지 않고 있네요.
올려주신 해결 방법으로 github repo를 직접 의존성으로 하는 것이 pypi에 패키지 업로드 할 때는 문제가 발생하네요.

일단 notion-py@refs/pull/294/merge 버전을 직접 가져와서 문제를 해결했습니다.
notion2github@v1.1.1, narkdown@v1.3.5에는 해당 문제가 반영되었습니다.

감사합니다.

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

No branches or pull requests

2 participants