Skip to content

Add document.patch() method #45

Description

@duckduckgrayduck

If I do something like:

document.data["ocr_engine"] = "azure"
document.save()

while a document is in a processing state from updating the page text, it returns me a failure:
squarelet.exceptions.APIError: 400 - ["You may not update access while the document is processing"]

But the field I'm updating in this case has nothing to do with access, it's just that save() calls a PUT which updates the whole document.

self.client.patch(
     f"documents/{document.id}/",
     json={"data": {"ocr_engine": ["azure"]}},
)

It would be nice if I could run something like

document.data["ocr_engine"] = "azure"
document.patch(["data"])

which is more clear and doesn't require me to call the bare client.patch method or know it exists.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions