본문 바로가기

D.S/Python

211011월 - notion 파이썬 패키지 에러 #1 NotionValidationError: Invalid input

728x90

 

공식 패키지가 아니다 보니..휴

 

이슈 #353

NotionValidationError: Invalid input when calling .get_rows()

 

 

코드를 아무것도 안 바꿨는데 갑자기 노션패키지(python)에서 NotionValidationError: Invalid input 에러를 뿜어댄다. 처음엔 이슈 #294인지를 적용하는건가 해서 업데이트했지만 여전히 에러 뿜뿜.

 

invalid input 이라니 나의 노션 페이지>검사로 들어가 queryCollection API 호출할 때 request payload 폼을 뒤져보니 현재 파이썬 패키지 코드에 명시되어 있는 것과 많이 다르다. 이슈 뒤져보니 나와 같은 사람이 있고, quick fix 되었다.

이슈 #353 에 들어가면 3개의 파일의 코드가 부분적으로 수정되어 있다.

 

업데이트 방법은 ..


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

 

윈도우 운영체제의 파이참을 사용중인데 setup.py에 있는 file read가 자꾸 encoding 문제가 생겼다. git clone으로 다운 받아서 requirements.txt를 ANSI로 수정해도 안 됨. 코드에서 파일 오픈할 때 encoding='utf-8' 로 수정해도 git+https 부분 파싱하는데 또 에러로 난리치고.. 깃 업데이트도 했는데.. 전혀 안 먹힘. 

참고로, 우분투 서버에서는 적용에 아무 문제가 없었다.

 


(base) C:\Users\...\git>pip install git+https://github.com/jamalex/notion-py.git@refs/pull/352/merge
Collecting git+https://github.com/jamalex/notion-py.git@refs/pull/352/merge
  Cloning https://github.com/jamalex/notion-py.git (to revision refs/pull/352/merge) to c:\users\myohy\appdata\local\temp\pip-req-build-k7ov0r_o
  Running command git clone -q https://github.com/jamalex/notion-py.git 'C:\Users\myohy\AppData\Local\Temp\pip-req-build-k7ov0r_o'
  WARNING: Did not find branch or tag 'refs/pull/352/merge', assuming revision or ref.
  Running command git fetch -q https://github.com/jamalex/notion-py.git refs/pull/352/merge
  Running command git checkout -q 017de43af765e232f6ba4403c5fa3513e614c955
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "", line 1, in 
      File "C:\Users\myohy\AppData\Local\Temp\pip-req-build-k7ov0r_o\setup.py", line 4, in 
        long_description = fh.read()
    UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 11949: illegal multibyte sequence
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\myohy\AppData\Local\Temp\pip-req-build-k7ov0r_o\

 

 

바꾼 후에는 잘 적용된다.

자동으로 글발행하다 손으로 옮기려니 엄청난 노동이...ㅠ

 

참고로 이 노션 파이썬 패키지는 노션이 공식으로 제공하는 API를 쓰는 게 아니고 노션 브라우저에서 사용하는 API를 가져다 씀. 그래서 처음에 토큰도 브라우저에서 가져오고... 별 생각 없었는데 안 되서 코드 들여다보다 API 버전이 v3라는 것에 잉? 했는데..그런 사연이 있었다. 끗.

 

 

 

반응형