jamalex / notion-py

Unofficial Python API client for Notion.so
MIT License
4.28k stars 476 forks source link

Client POST generates a HTTPError #389

Open thomashirtz opened 1 year ago

thomashirtz commented 1 year ago

Hello, As part of a module to clear deleted pages, this piece of code was working fine previously, however now it generates an 400 HTTP Error.

query = {
        'type': 'BlocksInSpace',
        'query': '',
        'filters': {
            'isDeletedOnly': True,
            'excludeTemplates': False,
            'isNavigableOnly': True,
            'requireEditPermissions': False,
            'ancestors': [],
            'createdBy': [],
            'editedBy': [],
            'lastEditedTime': {},
            'createdTime': {},
        },
        'sort': 'Relevance',
        'limit': 1000,
        # 'spaceId': space_id,
        'source': 'trash',
    }
    results = client.post(endpoint='/api/v3/search', data=query)
Traceback (most recent call last):
  File "D:/Thomas/GitHub/notion-clear-trash/notion_clear_trash.py", line 145, in <module>
    raise SystemExit(main())
  File "D:/Thomas/GitHub/notion-clear-trash/notion_clear_trash.py", line 133, in main
    block_id_list = get_trashed_block_id_list(
  File "D:/Thomas/GitHub/notion-clear-trash/notion_clear_trash.py", line 57, in get_trashed_block_id_list
    results = client.post(endpoint='/api/v3/search', data=query)
  File "c:\windows\system32\src\notion\notion\client.py", line 260, in post
    raise HTTPError(
requests.exceptions.HTTPError: Something went wrong. (400)

Did someone has a similar issue and know how to fix it ?

Thank you !

escarti commented 11 months ago

Solved already by this https://github.com/jamalex/notion-py/issues/385#issuecomment-1499259534