A small API wrapper for the paperless-ngx dms.
Project description
Paperless API
Async Python wrapper for the paperless-ngx REST API endpoint. Find out more here: https://paperless-ngx.readthedocs.io/en/latest/api.html
It is very simple and stupid. Maybe I will update it in the future to add some nice stuff.
Examples
Request a list of correspondents and print them.
import asyncio
import pypaperless
async def main():
api = pypaperless.PaperlessAPI("http://127.0.0.1:9120", "SUPER_SECRET_API_TOKEN_HERE")
# alternative: api = pypaperless.PaperlessAPI("http://127.0.0.1:9120", username="user", password="pass")
correspondents = await api.get_correspondents()
for data in correspondents:
print(data.raw_data)
asyncio.run(main())
Same is possible for every other endpoint provided by the API, excepting logs.
doctypes = await api.get_document_types()
tags = await api.get_tags()
views = await api.get_saved_views()
documents = await api.get_documents()
tasks = await apt.get_tasks()
Request a single item by id from an endpoint.
doctype = await api.get_document_type(3)
tag = await api.get_tag(6)
document = await api.get_document(6)
task = await api.get_task(123)
by_task_id = await api.get_task_by_task_id("fdaa724b-xxxx-yyyy-aaf8-edc5c113c656")
Post a document to Paperless. Only the file is mandatory, title, creation date correspondent id, and document type id are optional. Tags are crurrently not supported.
await api.post_document("./invoice.pdf",title="Invoice bedroom closet")
Create a new correspondent:
correspondent = {
"name": "test",
"match": "test",
"matching_algorithm": 3,
"is_insensitive": "false",
}
print (await api.add_correspondent(correspondent))
Search for a document and receive a list of results. Search syntax is the same as in Paperless: https://docs.paperless-ngx.com/usage/#basic-usage_searching.
matching_documents = await api.search("bedroom*")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypaperless-1.0.0.tar.gz.
File metadata
- Download URL: pypaperless-1.0.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
766f1955f2e44d5e5b205bfa2db4b5c158bd7d9748b1b2ee7755caa7efdd7978
|
|
| MD5 |
bce62efc794b63bff3bbaee5d8f30a85
|
|
| BLAKE2b-256 |
a04540bdb0934678691d79867d5505d07f4a37fa9ea0de8d1904cb3b518c8e38
|
File details
Details for the file pypaperless-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pypaperless-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74333bc28e1e4f6dd1783fdeef8be335b7ef2872e0b3d767b87748e8c6386216
|
|
| MD5 |
9bca92a53561faf1d50a1c82a1ff1f48
|
|
| BLAKE2b-256 |
2ad8cd388fdb196c68c46ac3ee6ef04d9690abf40a024e7c2c3d296478ba5f96
|