paperap.resources.documents module
METADATA:
- File: documents.py
Project: paperap
- Created: 2025-03-04
Version: 0.0.10
Author: Jess Mann Email: jess@jmann.me
Copyright (c) 2025 Jess Mann
LAST MODIFIED:
2025-03-04 By Jess Mann
- class paperap.resources.documents.DocumentResource(client)[source]
Bases:
StandardResource[Document,DocumentQuerySet]Resource for managing documents.
- Parameters:
client (
PaperlessClient)
- queryset_class
alias of
DocumentQuerySet
- name: str = 'documents'
- endpoints: ClassVar[Endpoints] = {'create': <string.Template object>, 'delete': <string.Template object>, 'detail': <string.Template object>, 'download': <string.Template object>, 'empty_trash': <string.Template object>, 'list': <string.Template object>, 'next_asn': <string.Template object>, 'preview': <string.Template object>, 'thumbnail': <string.Template object>, 'update': <string.Template object>, 'upload': <string.Template object>}
- upload_async(filepath, **metadata)[source]
Upload a document from a file to paperless ngx.
- Parameters:
filepath (
Path|str) – The path to the file to upload.- Return type:
- Returns:
A UUID string (task identifier) as returned by Paperless ngx. e.g. ca6a6dc8-b434-4fcd-8436-8b2546465622
- Raises:
FileNotFoundError – If the file does not exist.
ResourceNotFoundError – If the upload fails.
- upload_sync(filepath, max_wait=300, poll_interval=1.0, **metadata)[source]
Upload a document and wait until it has been processed.
- Parameters:
- Return type:
- Returns:
A Document instance once available.
- Raises:
APIError – If the document is not processed within the max_wait.
BadResponseError – If document processing succeeds but no document ID is returned.
- upload_content(file_content, filename, **metadata)[source]
Upload a document with optional metadata.
- Parameters:
- Returns:
ca6a6dc8-b434-4fcd-8436-8b2546465622 This is likely a task id, or similar.
- Return type:
A string that looks like this
- Raises:
ResourceNotFoundError – If the upload fails
- bulk_action(action, ids, **kwargs)[source]
Perform a bulk action on multiple documents.
- Parameters:
- Return type:
- Returns:
The API response
- Raises:
ConfigurationError – If the bulk edit endpoint is not defined
- bulk_merge(ids, metadata_document_id=None, delete_originals=False)[source]
Merge multiple documents.
- Parameters:
- Return type:
- Returns:
True if submitting the merge was successful
- Raises:
BadResponseError – If the merge action returns an unexpected response
APIError – If the merge action fails
- bulk_modify_custom_fields(ids, add_custom_fields=None, remove_custom_fields=None)[source]
Modify custom fields on multiple documents.
- bulk_set_permissions(ids, permissions=None, owner_id=None, merge=False)[source]
Set permissions for multiple documents.
- Parameters:
- Return type:
- Returns:
The API response
- client: PaperlessClient
- class paperap.resources.documents.DocumentNoteResource(client)[source]
Bases:
StandardResource[DocumentNote,DocumentNoteQuerySet]Resource for managing document notes.
- Parameters:
client (
PaperlessClient)
- model_class
alias of
DocumentNote
- queryset_class
alias of
DocumentNoteQuerySet
- name: str = 'notes'
- endpoints: ClassVar[Endpoints] = {'list': <string.Template object>}
- client: PaperlessClient