parseur-py 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Parseur
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: parseur-py
3
+ Version: 0.0.1
4
+ Summary: A Python client for the Parseur.com API to manage mailboxes, documents, uploads, and listen for new parsing events.
5
+ Author-email: Parseur Team <admin@parseur.com>
6
+ Project-URL: Homepage, https://github.com/parseur/parseur-py
7
+ Project-URL: Repository, https://github.com/parseur/parseur-py
8
+ Project-URL: Issues, https://github.com/parseur/parseur-py/issues
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: click>=8.2.1
13
+ Requires-Dist: requests>=2.31.0
14
+ Requires-Dist: marshmallow>=4.0.0
15
+ Dynamic: license-file
16
+
17
+ # πŸ€–πŸ§™parseur-py
18
+
19
+ **parseur-py** is a modern Python client for the [Parseur](https://parseur.com) API. It lets you **manage mailboxes, documents, uploads, and webhooks** programmatically or from the command line.
20
+
21
+ Built to help you automate document parsing at scale, parseur-py makes integrating with Parseur fast, easy, and Pythonic.
22
+
23
+ [![GitHub Repo](https://img.shields.io/badge/GitHub-parseur--py-blue?logo=github)](https://github.com/parseur/parseur-py)
24
+ [![PyPI version](https://badge.fury.io/py/parseur-py.svg)](https://badge.fury.io/py/parseur-py)
25
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
26
+
27
+ ---
28
+
29
+ ## ✨ Features
30
+
31
+ βœ… List, search, and sort mailboxes
32
+ βœ… Get mailbox details and schema
33
+ βœ… List, search, filter, and sort documents
34
+ βœ… Upload documents by file or email content
35
+ βœ… Reprocess, skip, copy, or delete documents
36
+ βœ… Manage custom webhooks for real-time events
37
+ βœ… Fully-featured **Command Line Interface (CLI)**
38
+
39
+ ---
40
+
41
+ ## πŸš€ Quick Start
42
+
43
+ ### Install the package
44
+
45
+ ```bash
46
+ pip install parseur-py
47
+ ```
48
+
49
+ ### Install the package from source
50
+
51
+ ```bash
52
+ pip install -e .
53
+ ```
54
+
55
+ ### Build documentation
56
+
57
+ ```bash
58
+ pip install -r requirements-doc.txt
59
+ cd docs
60
+ make html
61
+ ```
62
+
63
+ ---
64
+
65
+ ### Initialize your configuration
66
+
67
+ Store your Parseur API credentials securely:
68
+
69
+ ```bash
70
+ parseur init --api-key YOUR_PARSEUR_API_KEY
71
+ ```
72
+
73
+ Your config is saved (by default) in:
74
+
75
+ ```
76
+ ~/.parseur.conf
77
+ ```
78
+
79
+ ---
80
+
81
+ ### Example usage
82
+
83
+ List all your mailboxes:
84
+
85
+ ```bash
86
+ parseur list-mailboxes
87
+ ```
88
+
89
+ List documents in a mailbox:
90
+
91
+ ```bash
92
+ parseur list-documents 12345
93
+ ```
94
+
95
+ Upload a file to a mailbox:
96
+
97
+ ```bash
98
+ parseur upload-file 12345 ./path/to/document.pdf
99
+ ```
100
+
101
+ Register a custom webhook:
102
+
103
+ ```bash
104
+ parseur create-webhook --event document.processed --target-url https://yourserver.com/webhook --mailbox-id 12345
105
+ ```
106
+
107
+ ---
108
+
109
+ ## πŸ“œ CLI Commands
110
+
111
+ Run:
112
+
113
+ ```bash
114
+ parseur --help
115
+ ```
116
+
117
+ for a full list of available commands.
118
+
119
+ ### Highlights
120
+
121
+ - **init**: Set your API token and (optional) base URL
122
+ - **list-mailboxes**: Search and sort mailboxes
123
+ - **get-mailbox**: Fetch a mailbox by ID
124
+ - **get-mailbox-schema**: Get the mailbox parsing schema
125
+ - **list-documents**: Advanced document search, filtering, sorting
126
+ - **get-document**: Fetch document details
127
+ - **reprocess-document / skip-document / delete-document**: Document lifecycle operations
128
+ - **upload-file / upload-text**: Upload new documents
129
+ - **create-webhook / get-webhook / list-webhooks / delete-webhook**: Create, get, list, and delete custom webhook integrations.
130
+ - **enable-webhook / pause-webhook**: Activate or pause a webhook for a specific mailbox.
131
+
132
+ ---
133
+
134
+ ## πŸ”Ž Advanced Search & Filtering
135
+
136
+ **Mailbox listing supports:**
137
+
138
+ - **Search** by name or email prefix
139
+ - **Sort** by:
140
+ - name
141
+ - document_count
142
+ - template_count
143
+ - PARSEDOK_count (processed)
144
+ - PARSEDKO_count (failed)
145
+ - QUOTAEXC_count (quota exceeded)
146
+ - EXPORTKO_count (export failed)
147
+
148
+ **Document listing supports:**
149
+
150
+ - **Search** in:
151
+ - document ID
152
+ - document name
153
+ - template name
154
+ - email addresses (from, to, cc, bcc)
155
+ - document metadata header
156
+ - **Sort** by:
157
+ - name
158
+ - created (received date)
159
+ - processed date
160
+ - status
161
+ - **Filter** by:
162
+ - received_after / received_before dates
163
+ - **Include** parsed result in response
164
+
165
+ ---
166
+
167
+ ## ⚑ Webhooks Support
168
+
169
+ Easily register custom webhooks for events like:
170
+
171
+ - `document.processed`
172
+ - `document.processed.flattened`
173
+ - `document.template_needed`
174
+ - `document.export_failed`
175
+ - `table.processed`
176
+ - `table.processed.flattened`
177
+
178
+ Your webhook endpoint will receive POST notifications with Parseur payloads, enabling real-time integrations with your systems.
179
+
180
+ ---
181
+
182
+ ## πŸ› οΈ Configuration
183
+
184
+ Your API token and settings are stored in a simple INI file:
185
+
186
+ ```
187
+ [parseur]
188
+ api_token = YOUR_API_KEY
189
+ base_url = https://api.parseur.com
190
+ ```
191
+
192
+ You can customize the path by setting \`--config-path\` in your calls if needed.
193
+
194
+ ---
195
+
196
+ ## 🐍 Python Client Usage
197
+
198
+ Beyond the CLI, **parseur-py** is a standard Python library. Example:
199
+
200
+ ```python
201
+ import parseur
202
+
203
+ parseur.api_key = "YOUR_API_KEY"
204
+
205
+ for mailbox in parseur.Mailbox.list():
206
+ print(mailbox["name"])
207
+ ```
208
+
209
+ ---
210
+
211
+ ## πŸ“– Documentation
212
+
213
+ - [Parseur Official API Docs](https://help.parseur.com/en/articles/3566128-use-parseur-document-parsing-api)
214
+ - This package mirrors Parseur’s REST API, adding pagination handling, schema support, and convenient CLI commands.
215
+
216
+ ---
217
+
218
+ ## πŸ’Ό License
219
+
220
+ MIT License
221
+
222
+ ---
223
+
224
+ ## 🀝 Contributing
225
+
226
+ We welcome contributions! Please:
227
+
228
+ 1. Fork the repo
229
+ 2. Create your feature branch (`git checkout -b feature/foo`)
230
+ 3. Commit your changes (`git commit -am 'Add foo'`)
231
+ 4. Push to the branch (`git push origin feature/foo`)
232
+ 5. Open a pull request
233
+
234
+ ---
235
+
236
+ ## ✨ Credits
237
+
238
+ Developed with ❀️ by the [Parseur](https://parseur.com) team.
239
+
240
+ ---
241
+
242
+ *Parseur is the easiest way to automatically extract data from emails and documents. Stop copy-pasting data and automate your workflows!*
@@ -0,0 +1,226 @@
1
+ # πŸ€–πŸ§™parseur-py
2
+
3
+ **parseur-py** is a modern Python client for the [Parseur](https://parseur.com) API. It lets you **manage mailboxes, documents, uploads, and webhooks** programmatically or from the command line.
4
+
5
+ Built to help you automate document parsing at scale, parseur-py makes integrating with Parseur fast, easy, and Pythonic.
6
+
7
+ [![GitHub Repo](https://img.shields.io/badge/GitHub-parseur--py-blue?logo=github)](https://github.com/parseur/parseur-py)
8
+ [![PyPI version](https://badge.fury.io/py/parseur-py.svg)](https://badge.fury.io/py/parseur-py)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+
11
+ ---
12
+
13
+ ## ✨ Features
14
+
15
+ βœ… List, search, and sort mailboxes
16
+ βœ… Get mailbox details and schema
17
+ βœ… List, search, filter, and sort documents
18
+ βœ… Upload documents by file or email content
19
+ βœ… Reprocess, skip, copy, or delete documents
20
+ βœ… Manage custom webhooks for real-time events
21
+ βœ… Fully-featured **Command Line Interface (CLI)**
22
+
23
+ ---
24
+
25
+ ## πŸš€ Quick Start
26
+
27
+ ### Install the package
28
+
29
+ ```bash
30
+ pip install parseur-py
31
+ ```
32
+
33
+ ### Install the package from source
34
+
35
+ ```bash
36
+ pip install -e .
37
+ ```
38
+
39
+ ### Build documentation
40
+
41
+ ```bash
42
+ pip install -r requirements-doc.txt
43
+ cd docs
44
+ make html
45
+ ```
46
+
47
+ ---
48
+
49
+ ### Initialize your configuration
50
+
51
+ Store your Parseur API credentials securely:
52
+
53
+ ```bash
54
+ parseur init --api-key YOUR_PARSEUR_API_KEY
55
+ ```
56
+
57
+ Your config is saved (by default) in:
58
+
59
+ ```
60
+ ~/.parseur.conf
61
+ ```
62
+
63
+ ---
64
+
65
+ ### Example usage
66
+
67
+ List all your mailboxes:
68
+
69
+ ```bash
70
+ parseur list-mailboxes
71
+ ```
72
+
73
+ List documents in a mailbox:
74
+
75
+ ```bash
76
+ parseur list-documents 12345
77
+ ```
78
+
79
+ Upload a file to a mailbox:
80
+
81
+ ```bash
82
+ parseur upload-file 12345 ./path/to/document.pdf
83
+ ```
84
+
85
+ Register a custom webhook:
86
+
87
+ ```bash
88
+ parseur create-webhook --event document.processed --target-url https://yourserver.com/webhook --mailbox-id 12345
89
+ ```
90
+
91
+ ---
92
+
93
+ ## πŸ“œ CLI Commands
94
+
95
+ Run:
96
+
97
+ ```bash
98
+ parseur --help
99
+ ```
100
+
101
+ for a full list of available commands.
102
+
103
+ ### Highlights
104
+
105
+ - **init**: Set your API token and (optional) base URL
106
+ - **list-mailboxes**: Search and sort mailboxes
107
+ - **get-mailbox**: Fetch a mailbox by ID
108
+ - **get-mailbox-schema**: Get the mailbox parsing schema
109
+ - **list-documents**: Advanced document search, filtering, sorting
110
+ - **get-document**: Fetch document details
111
+ - **reprocess-document / skip-document / delete-document**: Document lifecycle operations
112
+ - **upload-file / upload-text**: Upload new documents
113
+ - **create-webhook / get-webhook / list-webhooks / delete-webhook**: Create, get, list, and delete custom webhook integrations.
114
+ - **enable-webhook / pause-webhook**: Activate or pause a webhook for a specific mailbox.
115
+
116
+ ---
117
+
118
+ ## πŸ”Ž Advanced Search & Filtering
119
+
120
+ **Mailbox listing supports:**
121
+
122
+ - **Search** by name or email prefix
123
+ - **Sort** by:
124
+ - name
125
+ - document_count
126
+ - template_count
127
+ - PARSEDOK_count (processed)
128
+ - PARSEDKO_count (failed)
129
+ - QUOTAEXC_count (quota exceeded)
130
+ - EXPORTKO_count (export failed)
131
+
132
+ **Document listing supports:**
133
+
134
+ - **Search** in:
135
+ - document ID
136
+ - document name
137
+ - template name
138
+ - email addresses (from, to, cc, bcc)
139
+ - document metadata header
140
+ - **Sort** by:
141
+ - name
142
+ - created (received date)
143
+ - processed date
144
+ - status
145
+ - **Filter** by:
146
+ - received_after / received_before dates
147
+ - **Include** parsed result in response
148
+
149
+ ---
150
+
151
+ ## ⚑ Webhooks Support
152
+
153
+ Easily register custom webhooks for events like:
154
+
155
+ - `document.processed`
156
+ - `document.processed.flattened`
157
+ - `document.template_needed`
158
+ - `document.export_failed`
159
+ - `table.processed`
160
+ - `table.processed.flattened`
161
+
162
+ Your webhook endpoint will receive POST notifications with Parseur payloads, enabling real-time integrations with your systems.
163
+
164
+ ---
165
+
166
+ ## πŸ› οΈ Configuration
167
+
168
+ Your API token and settings are stored in a simple INI file:
169
+
170
+ ```
171
+ [parseur]
172
+ api_token = YOUR_API_KEY
173
+ base_url = https://api.parseur.com
174
+ ```
175
+
176
+ You can customize the path by setting \`--config-path\` in your calls if needed.
177
+
178
+ ---
179
+
180
+ ## 🐍 Python Client Usage
181
+
182
+ Beyond the CLI, **parseur-py** is a standard Python library. Example:
183
+
184
+ ```python
185
+ import parseur
186
+
187
+ parseur.api_key = "YOUR_API_KEY"
188
+
189
+ for mailbox in parseur.Mailbox.list():
190
+ print(mailbox["name"])
191
+ ```
192
+
193
+ ---
194
+
195
+ ## πŸ“– Documentation
196
+
197
+ - [Parseur Official API Docs](https://help.parseur.com/en/articles/3566128-use-parseur-document-parsing-api)
198
+ - This package mirrors Parseur’s REST API, adding pagination handling, schema support, and convenient CLI commands.
199
+
200
+ ---
201
+
202
+ ## πŸ’Ό License
203
+
204
+ MIT License
205
+
206
+ ---
207
+
208
+ ## 🀝 Contributing
209
+
210
+ We welcome contributions! Please:
211
+
212
+ 1. Fork the repo
213
+ 2. Create your feature branch (`git checkout -b feature/foo`)
214
+ 3. Commit your changes (`git commit -am 'Add foo'`)
215
+ 4. Push to the branch (`git push origin feature/foo`)
216
+ 5. Open a pull request
217
+
218
+ ---
219
+
220
+ ## ✨ Credits
221
+
222
+ Developed with ❀️ by the [Parseur](https://parseur.com) team.
223
+
224
+ ---
225
+
226
+ *Parseur is the easiest way to automatically extract data from emails and documents. Stop copy-pasting data and automate your workflows!*
@@ -0,0 +1,31 @@
1
+ from pathlib import Path
2
+
3
+ from parseur.config import Config
4
+ from parseur.document import Document, DocumentOrderKey
5
+ from parseur.event import ParseurEvent
6
+ from parseur.mailbox import Mailbox, MailboxOrderKey
7
+ from parseur.schemas.document import DocumentStatus
8
+ from parseur.utils import to_json
9
+ from parseur.webhook import Webhook
10
+
11
+ __all__ = [
12
+ "Config",
13
+ "Document",
14
+ "DocumentOrderKey",
15
+ "DocumentStatus",
16
+ "Mailbox",
17
+ "MailboxOrderKey",
18
+ "ParseurEvent",
19
+ "Webhook",
20
+ "to_json",
21
+ ]
22
+
23
+
24
+ CONFIG_PATH = Path.home() / ".parseur.conf"
25
+ config = Config(CONFIG_PATH)
26
+ config.load()
27
+
28
+ DEFAULT_API_BASE = "https://api.parseur.com"
29
+
30
+ api_key = config.api_key
31
+ api_base = config.api_base or DEFAULT_API_BASE