jheddings / notional

A high level interface and object model for the Notion SDK.
https://jheddings.github.io/notional/
MIT License
99 stars 16 forks source link

Page updates fail when page properties are read only. #9

Open jheddings opened 3 years ago

jheddings commented 3 years ago

Submitting page changes breaks when the page contains properties that are read only, such as formula and created_by.

Version: HEAD

Traceback (most recent call last):
  File ".../notional/examples/props.py", line 40, in <module>
    notion.pages.update(page)
  File ".../notional/notional/session.py", line 249, in update
    data = self().update(page.id.hex, **diff)
  File ".../notional/.venv/lib/python3.9/site-packages/notion_client/api_endpoints.py", line 164, in update
    return self.parent.request(
  File ".../notional/.venv/lib/python3.9/site-packages/notion_client/client.py", line 155, in request
    return self._parse_response(response)
  File ".../notional/.venv/lib/python3.9/site-packages/notion_client/client.py", line 111, in _parse_response
    raise APIResponseError(response, body["message"], code)
notion_client.errors.APIResponseError: body failed validation. Fix one: body.properties.Created By.title should be defined, instead was `undefined`. body.properties.Created By.rich_text should be defined, instead was `undefined`. body.properties.Created By.number should be defined, instead was `undefined`. body.properties.Created By.url should be defined, instead was `undefined`. body.properties.Created By.select should be defined, instead was `undefined`. body.properties.Created By.multi_select should be defined, instead was `undefined`. body.properties.Created By.people should be defined, instead was `undefined`. body.properties.Created By.email should be defined, instead was `undefined`. body.properties.Created By.phone_number should be defined, instead was `undefined`. body.properties.Created By.date should be defined, instead was `undefined`. body.properties.Created By.checkbox should be defined, instead was `undefined`. body.properties.Created By.relation should be defined, instead was `undefined`. body.properties.Created By.files should be defined, instead was `undefined`. 
jheddings commented 3 years ago

Currently, updating pages simply grabs the page properties and submits them back... The API doesn't like when those properties are view only.

Possible options: