docuseal 1.0.0__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.
- docuseal-1.0.0/LICENSE +21 -0
- docuseal-1.0.0/PKG-INFO +36 -0
- docuseal-1.0.0/README.md +373 -0
- docuseal-1.0.0/docuseal/__init__.py +5 -0
- docuseal-1.0.0/docuseal/_api.py +118 -0
- docuseal-1.0.0/docuseal/_http.py +73 -0
- docuseal-1.0.0/docuseal/_version.py +1 -0
- docuseal-1.0.0/docuseal.egg-info/PKG-INFO +36 -0
- docuseal-1.0.0/docuseal.egg-info/SOURCES.txt +11 -0
- docuseal-1.0.0/docuseal.egg-info/dependency_links.txt +1 -0
- docuseal-1.0.0/docuseal.egg-info/top_level.txt +1 -0
- docuseal-1.0.0/setup.cfg +4 -0
- docuseal-1.0.0/setup.py +41 -0
docuseal-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 DocuSeal LLC
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
docuseal-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: docuseal
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A example Python package
|
|
5
|
+
Home-page: https://github.com/docusealco/docuseal-python
|
|
6
|
+
Author: DocuSeal
|
|
7
|
+
Author-email: admin@docuseal.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/docuseaoco/docuseal-python/issues
|
|
10
|
+
Project-URL: Changes, https://github.com/docuseaoco/docuseal-python/blob/master/CHANGELOG.md
|
|
11
|
+
Project-URL: Documentation, https://www.docuseal.com/docs/api?lang=python
|
|
12
|
+
Project-URL: Source Code, https://github.com/docuseaoco/docuseal-python
|
|
13
|
+
Keywords: docuseal document signature
|
|
14
|
+
Platform: UNKNOWN
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
29
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
30
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
31
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
32
|
+
Requires-Python: >=3.6
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
|
|
35
|
+
UNKNOWN
|
|
36
|
+
|
docuseal-1.0.0/README.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# DocuSeal Python
|
|
2
|
+
|
|
3
|
+
The DocuSeal Python library provides seamless integration with the DocuSeal API, allowing developers to interact with DocuSeal's electronic signature and document management features directly within Python applications. This library is designed to simplify API interactions and provide tools for efficient implementation.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
Detailed documentation is available at [DocuSeal API Docs](https://www.docuseal.com/docs/api?lang=python).
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
Python 3.5 and later.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pip install --upgrade docuseal
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Install from source with:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
python setup.py install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Configuration
|
|
28
|
+
|
|
29
|
+
Set up the library with your DocuSeal API key based on your deployment. Retrieve your API key from the appropriate location:
|
|
30
|
+
|
|
31
|
+
#### Global Cloud
|
|
32
|
+
|
|
33
|
+
API keys for the global cloud can be obtained from your [Global DocuSeal Console](https://console.docuseal.com/api).
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from docuseal import docuseal
|
|
37
|
+
|
|
38
|
+
docuseal.key = "API_KEY"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### EU Cloud
|
|
42
|
+
|
|
43
|
+
API keys for the EU cloud can be obtained from your [EU DocuSeal Console](https://console.docuseal.eu/api).
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from docuseal import docuseal
|
|
47
|
+
|
|
48
|
+
docuseal.key = "API_KEY"
|
|
49
|
+
docuseal.url = "https://api.docuseal.eu"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### On-Premises
|
|
53
|
+
|
|
54
|
+
For on-premises installations, API keys can be retrieved from the API settings page of your deployed application, e.g., https://yourdocusealapp.com/settings/api.
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from docuseal import docuseal
|
|
58
|
+
|
|
59
|
+
docuseal.key = "API_KEY"
|
|
60
|
+
docuseal.url = "https://yourdocusealapp.com/api"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## API Methods
|
|
64
|
+
|
|
65
|
+
### list_submissions(params)
|
|
66
|
+
|
|
67
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#list-all-submissions)
|
|
68
|
+
|
|
69
|
+
Provides the ability to retrieve a list of available submissions.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
docuseal.list_submissions({ "limit": 10 })
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### get_submission(id)
|
|
77
|
+
|
|
78
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#get-a-submission)
|
|
79
|
+
|
|
80
|
+
Provides the functionality to retrieve information about a submission.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
docuseal.get_submission(1001)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### create_submission(data)
|
|
88
|
+
|
|
89
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#create-a-submission)
|
|
90
|
+
|
|
91
|
+
This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
|
|
92
|
+
|
|
93
|
+
**Related Guides:**<br>
|
|
94
|
+
[Send documents for signature via API](https://www.docuseal.com/guides/send-documents-for-signature-via-api)
|
|
95
|
+
[Pre-fill PDF document form fields with API](https://www.docuseal.com/guides/pre-fill-pdf-document-form-fields-with-api)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
docuseal.create_submission({
|
|
100
|
+
"template_id": 1000001,
|
|
101
|
+
"send_email": True,
|
|
102
|
+
"submitters": [
|
|
103
|
+
{
|
|
104
|
+
"role": "First Party",
|
|
105
|
+
"email": "john.doe@example.com"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### create_submission_from_emails(data)
|
|
112
|
+
|
|
113
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#create-submissions-from-emails)
|
|
114
|
+
|
|
115
|
+
This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
docuseal.create_submission_from_emails({
|
|
120
|
+
"template_id": 1000001,
|
|
121
|
+
"emails": "hi@docuseal.com, example@docuseal.com"
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### archive_submission(id)
|
|
126
|
+
|
|
127
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#archive-a-submission)
|
|
128
|
+
|
|
129
|
+
Allows you to archive a submission.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
docuseal.archive_submission(1001)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### list_submissions(params)
|
|
137
|
+
|
|
138
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#list-all-submitters)
|
|
139
|
+
|
|
140
|
+
Provides the ability to retrieve a list of submitters.
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
docuseal.list_submissions({ "limit": 10 })
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### get_submitter(id)
|
|
148
|
+
|
|
149
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#get-a-submitter)
|
|
150
|
+
|
|
151
|
+
Provides the functionality to retrieve information about a submitter.
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
docuseal.get_submitter(500001)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### update_submitter(id, data)
|
|
159
|
+
|
|
160
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#update-a-submitter)
|
|
161
|
+
|
|
162
|
+
Allows you to update submitter details, pre-fill or update field values and re-send emails.
|
|
163
|
+
|
|
164
|
+
**Related Guides:**<br>
|
|
165
|
+
[Automatically sign documents via API](https://www.docuseal.com/guides/pre-fill-pdf-document-form-fields-with-api#automatically_sign_documents_via_api)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
docuseal.update_submitter(500001, {
|
|
170
|
+
"email": "john.doe@example.com",
|
|
171
|
+
"fields": [
|
|
172
|
+
{
|
|
173
|
+
"name": "First Name",
|
|
174
|
+
"default_value": "Acme"
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
})
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### list_submissions(params)
|
|
181
|
+
|
|
182
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#list-all-templates)
|
|
183
|
+
|
|
184
|
+
Provides the ability to retrieve a list of available document templates.
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
docuseal.list_submissions({ "limit": 10 })
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### get_template(id)
|
|
192
|
+
|
|
193
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#get-a-template)
|
|
194
|
+
|
|
195
|
+
Provides the functionality to retrieve information about a document template.
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
docuseal.get_template(1000001)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### create_template_from_docx(data)
|
|
203
|
+
|
|
204
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#create-a-template-from-word-docx)
|
|
205
|
+
|
|
206
|
+
Provides the functionality to create a fillable document template for existing Microsoft Word document. Use `{{Field Name;role=Signer1;type=date}}` text tags to define fillable fields in the document. See [https://www.docuseal.com/examples/fieldtags.docx](https://www.docuseal.com/examples/fieldtags.docx) for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
|
|
207
|
+
|
|
208
|
+
**Related Guides:**<br>
|
|
209
|
+
[Use embedded text field tags to create a fillable form](https://www.docuseal.com/guides/use-embedded-text-field-tags-in-the-pdf-to-create-a-fillable-form)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
docuseal.create_template_from_docx({
|
|
214
|
+
"name": "Test DOCX",
|
|
215
|
+
"documents": [
|
|
216
|
+
{
|
|
217
|
+
"name": "string",
|
|
218
|
+
"file": "base64"
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### create_template_from_html(data)
|
|
225
|
+
|
|
226
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#create-a-template-from-html)
|
|
227
|
+
|
|
228
|
+
Provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
|
|
229
|
+
|
|
230
|
+
**Related Guides:**<br>
|
|
231
|
+
[Create PDF document fillable form with HTML](https://www.docuseal.com/guides/create-pdf-document-fillable-form-with-html-api)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
docuseal.create_template_from_html({
|
|
236
|
+
"html": """<p>Lorem Ipsum is simply dummy text of the
|
|
237
|
+
<text-field
|
|
238
|
+
name=\"Industry\"
|
|
239
|
+
role=\"First Party\"
|
|
240
|
+
required=\"false\"
|
|
241
|
+
style=\"width: 80px; height: 16px; display: inline-block; margin-bottom: -4px\">
|
|
242
|
+
</text-field>
|
|
243
|
+
and typesetting industry</p>
|
|
244
|
+
""",
|
|
245
|
+
"name": "Test Template"
|
|
246
|
+
})
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### merge_templates(data)
|
|
250
|
+
|
|
251
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#merge-templates)
|
|
252
|
+
|
|
253
|
+
Allows you to merge multiple templates with documents and fields into a new combined template.
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
docuseal.merge_templates({
|
|
258
|
+
"template_ids": [
|
|
259
|
+
321,
|
|
260
|
+
432
|
|
261
|
+
],
|
|
262
|
+
"name": "Merged Template"
|
|
263
|
+
})
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### create_template_from_pdf(data)
|
|
267
|
+
|
|
268
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#create-a-template-from-existing-pdf)
|
|
269
|
+
|
|
270
|
+
Provides the functionality to create a fillable document template for existing PDF file. Use `{{Field Name;role=Signer1;type=date}}` text tags to define fillable fields in the document. See [https://www.docuseal.com/examples/fieldtags.pdf](https://www.docuseal.com/examples/fieldtags.pdf) for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
|
|
271
|
+
|
|
272
|
+
**Related Guides:**<br>
|
|
273
|
+
[Use embedded text field tags to create a fillable form](https://www.docuseal.com/guides/use-embedded-text-field-tags-in-the-pdf-to-create-a-fillable-form)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
```python
|
|
277
|
+
docuseal.create_template_from_pdf({
|
|
278
|
+
"name": "Test PDF",
|
|
279
|
+
"documents": [
|
|
280
|
+
{
|
|
281
|
+
"name": "string",
|
|
282
|
+
"file": "base64",
|
|
283
|
+
"fields": [
|
|
284
|
+
{
|
|
285
|
+
"name": "string",
|
|
286
|
+
"areas": [
|
|
287
|
+
{
|
|
288
|
+
"x": 0,
|
|
289
|
+
"y": 0,
|
|
290
|
+
"w": 0,
|
|
291
|
+
"h": 0,
|
|
292
|
+
"page": 1
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
})
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### clone_template(id, data)
|
|
303
|
+
|
|
304
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#clone-a-template)
|
|
305
|
+
|
|
306
|
+
Allows you to clone existing template into a new template.
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
```python
|
|
310
|
+
docuseal.clone_template(1000001, {
|
|
311
|
+
"name": "Cloned Template"
|
|
312
|
+
})
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### update_template(id, data)
|
|
316
|
+
|
|
317
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#update-a-template)
|
|
318
|
+
|
|
319
|
+
Provides the functionality to move a document template to a different folder and update the name of the template.
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
```python
|
|
323
|
+
docuseal.update_template(1000001, {
|
|
324
|
+
"name": "New Document Name",
|
|
325
|
+
"folder_name": "New Folder"
|
|
326
|
+
})
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### update_template_documents(id, data)
|
|
330
|
+
|
|
331
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#update-template-documents)
|
|
332
|
+
|
|
333
|
+
Allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content.
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
```python
|
|
337
|
+
docuseal.update_template_documents(1000001, {
|
|
338
|
+
"documents": [
|
|
339
|
+
{
|
|
340
|
+
"file": "string"
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
})
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### archive_template(id)
|
|
347
|
+
|
|
348
|
+
[Documentation](https://www.docuseal.com/docs/api?lang=python#archive-a-template)
|
|
349
|
+
|
|
350
|
+
Allows you to archive a document template.
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
```python
|
|
354
|
+
docuseal.archive_template(1000001)
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Configuring Timeouts
|
|
358
|
+
|
|
359
|
+
Set timeouts to avoid hanging requests:
|
|
360
|
+
|
|
361
|
+
```ruby
|
|
362
|
+
docuseal.open_timeout = 30
|
|
363
|
+
docuseal.read_timeout = 30
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## Support
|
|
367
|
+
|
|
368
|
+
For feature requests or bug reports, visit our [GitHub Issues page](https://github.com/docusealco/docuseal-python/issues).
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
## License
|
|
372
|
+
|
|
373
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from docuseal._http import DocusealHttp
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DocusealApi:
|
|
5
|
+
def __init__(self, key=None, url="https://api.docuseal.com", read_timeout=60, open_timeout=60):
|
|
6
|
+
self.config = {}
|
|
7
|
+
|
|
8
|
+
self.config["key"] = key
|
|
9
|
+
self.config["url"] = url
|
|
10
|
+
self.config["read_timeout"] = read_timeout
|
|
11
|
+
self.config["open_timeout"] = open_timeout
|
|
12
|
+
|
|
13
|
+
self.http = DocusealHttp(self.config)
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def key(self):
|
|
17
|
+
return self.config["key"]
|
|
18
|
+
|
|
19
|
+
@key.setter
|
|
20
|
+
def key(self, value):
|
|
21
|
+
self.config["key"] = value
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def url(self):
|
|
25
|
+
return self.config["url"]
|
|
26
|
+
|
|
27
|
+
@url.setter
|
|
28
|
+
def url(self, value):
|
|
29
|
+
self.config["url"] = value
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def read_timeout(self):
|
|
33
|
+
return self.config["read_timeout"]
|
|
34
|
+
|
|
35
|
+
@read_timeout.setter
|
|
36
|
+
def read_timeout(self, value):
|
|
37
|
+
self.config["read_timeout"] = value
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def open_timeout(self):
|
|
41
|
+
return self.config["open_timeout"]
|
|
42
|
+
|
|
43
|
+
@open_timeout.setter
|
|
44
|
+
def open_timeout(self, value):
|
|
45
|
+
self.config["open_timeout"] = value
|
|
46
|
+
|
|
47
|
+
def list_templates(self, params=None):
|
|
48
|
+
if params is None:
|
|
49
|
+
params = {}
|
|
50
|
+
return self.http.get("/templates", params)
|
|
51
|
+
|
|
52
|
+
def get_template(self, template_id, params=None):
|
|
53
|
+
if params is None:
|
|
54
|
+
params = {}
|
|
55
|
+
return self.http.get(f"/templates/{template_id}", params)
|
|
56
|
+
|
|
57
|
+
def create_template_from_docx(self, data):
|
|
58
|
+
return self.http.post("/templates/docx", data)
|
|
59
|
+
|
|
60
|
+
def create_template_from_html(self, data):
|
|
61
|
+
return self.http.post("/templates/html", data)
|
|
62
|
+
|
|
63
|
+
def create_template_from_pdf(self, data):
|
|
64
|
+
return self.http.post("/templates/pdf", data)
|
|
65
|
+
|
|
66
|
+
def merge_templates(self, data):
|
|
67
|
+
return self.http.post("/templates/merge", data)
|
|
68
|
+
|
|
69
|
+
def clone_template(self, template_id, data):
|
|
70
|
+
return self.http.post(f"/templates/{template_id}/clone", data)
|
|
71
|
+
|
|
72
|
+
def update_template(self, template_id, data):
|
|
73
|
+
return self.http.put(f"/templates/{template_id}", data)
|
|
74
|
+
|
|
75
|
+
def update_template_documents(self, template_id, data):
|
|
76
|
+
return self.http.put(f"/templates/{template_id}/documents", data)
|
|
77
|
+
|
|
78
|
+
def archive_template(self, template_id):
|
|
79
|
+
return self.http.delete(f"/templates/{template_id}")
|
|
80
|
+
|
|
81
|
+
def permanently_delete_template(self, template_id):
|
|
82
|
+
return self.http.delete(f"/templates/{template_id}", {"permanently": True})
|
|
83
|
+
|
|
84
|
+
def list_submissions(self, params=None):
|
|
85
|
+
if params is None:
|
|
86
|
+
params = {}
|
|
87
|
+
return self.http.get("/submissions", params)
|
|
88
|
+
|
|
89
|
+
def get_submission(self, submission_id, params=None):
|
|
90
|
+
if params is None:
|
|
91
|
+
params = {}
|
|
92
|
+
return self.http.get(f"/submissions/{submission_id}", params)
|
|
93
|
+
|
|
94
|
+
def create_submission(self, data):
|
|
95
|
+
return self.http.post("/submissions/init", data)
|
|
96
|
+
|
|
97
|
+
def create_submission_from_emails(self, data):
|
|
98
|
+
return self.http.post("/submissions/emails", data)
|
|
99
|
+
|
|
100
|
+
def archive_submission(self, submission_id):
|
|
101
|
+
return self.http.delete(f"/submissions/{submission_id}")
|
|
102
|
+
|
|
103
|
+
def permanently_delete_submission(self, submission_id):
|
|
104
|
+
return self.http.delete(f"/submissions/{submission_id}", {"permanently": True})
|
|
105
|
+
|
|
106
|
+
def list_submitters(self, params=None):
|
|
107
|
+
if params is None:
|
|
108
|
+
params = {}
|
|
109
|
+
return self.http.get("/submitters", params)
|
|
110
|
+
|
|
111
|
+
def get_submitter(self, submitter_id, params=None):
|
|
112
|
+
if params is None:
|
|
113
|
+
params = {}
|
|
114
|
+
return self.http.get(f"/submitters/{submitter_id}", params)
|
|
115
|
+
|
|
116
|
+
def update_submitter(self, submitter_id, data):
|
|
117
|
+
return self.http.put(f"/submitters/{submitter_id}", data)
|
|
118
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import urllib.parse
|
|
3
|
+
import http.client
|
|
4
|
+
from docuseal._version import VERSION
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ApiError(Exception):
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DocusealHttp:
|
|
12
|
+
BODY_METHODS = {"POST", "PUT"}
|
|
13
|
+
|
|
14
|
+
def __init__(self, config):
|
|
15
|
+
self.config = config
|
|
16
|
+
|
|
17
|
+
def get(self, path, params=None):
|
|
18
|
+
return self.send_request("GET", path, params)
|
|
19
|
+
|
|
20
|
+
def post(self, path, body=None):
|
|
21
|
+
return self.send_request("POST", path, None, body)
|
|
22
|
+
|
|
23
|
+
def put(self, path, body=None):
|
|
24
|
+
return self.send_request("PUT", path, None, body)
|
|
25
|
+
|
|
26
|
+
def delete(self, path, params=None):
|
|
27
|
+
return self.send_request("DELETE", path, params)
|
|
28
|
+
|
|
29
|
+
def send_request(self, method, path, params=None, body=None):
|
|
30
|
+
if params is None:
|
|
31
|
+
params = {}
|
|
32
|
+
|
|
33
|
+
url = urllib.parse.urljoin(self.config["url"], path)
|
|
34
|
+
full_path = f"{url}{self.to_query(params)}"
|
|
35
|
+
|
|
36
|
+
parsed_url = urllib.parse.urlparse(full_path)
|
|
37
|
+
connection_class = (
|
|
38
|
+
http.client.HTTPSConnection
|
|
39
|
+
if parsed_url.scheme == "https"
|
|
40
|
+
else http.client.HTTPConnection
|
|
41
|
+
)
|
|
42
|
+
conn = connection_class(
|
|
43
|
+
parsed_url.hostname or "", parsed_url.port, timeout=self.config.get("open_timeout", 60)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
headers = self.headers()
|
|
47
|
+
data = json.dumps(body) if body is not None else None
|
|
48
|
+
|
|
49
|
+
conn.request(method, f"{parsed_url.path}?{parsed_url.query}", body=data, headers=headers)
|
|
50
|
+
response = conn.getresponse()
|
|
51
|
+
|
|
52
|
+
conn.sock.settimeout(self.config.get("read_timeout", 60))
|
|
53
|
+
|
|
54
|
+
return self.handle_response(response)
|
|
55
|
+
|
|
56
|
+
def headers(self):
|
|
57
|
+
return {
|
|
58
|
+
"X-Auth-Token": self.config["key"] or "",
|
|
59
|
+
"Content-Type": "application/json",
|
|
60
|
+
"User-Agent": f"DocuSeal Python v{VERSION}",
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
def to_query(self, params):
|
|
64
|
+
if not params:
|
|
65
|
+
return ""
|
|
66
|
+
return f"?{urllib.parse.urlencode(params)}"
|
|
67
|
+
|
|
68
|
+
def handle_response(self, response):
|
|
69
|
+
response_body = response.read().decode("utf-8")
|
|
70
|
+
if 200 <= response.status < 300:
|
|
71
|
+
return json.loads(response_body)
|
|
72
|
+
else:
|
|
73
|
+
raise ApiError(f"API Error {response.status}: {response_body}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "1.0.0"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: docuseal
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A example Python package
|
|
5
|
+
Home-page: https://github.com/docusealco/docuseal-python
|
|
6
|
+
Author: DocuSeal
|
|
7
|
+
Author-email: admin@docuseal.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/docuseaoco/docuseal-python/issues
|
|
10
|
+
Project-URL: Changes, https://github.com/docuseaoco/docuseal-python/blob/master/CHANGELOG.md
|
|
11
|
+
Project-URL: Documentation, https://www.docuseal.com/docs/api?lang=python
|
|
12
|
+
Project-URL: Source Code, https://github.com/docuseaoco/docuseal-python
|
|
13
|
+
Keywords: docuseal document signature
|
|
14
|
+
Platform: UNKNOWN
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
29
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
30
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
31
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
32
|
+
Requires-Python: >=3.6
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
|
|
35
|
+
UNKNOWN
|
|
36
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
docuseal
|
docuseal-1.0.0/setup.cfg
ADDED
docuseal-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='docuseal',
|
|
5
|
+
version='1.0.0',
|
|
6
|
+
description='A example Python package',
|
|
7
|
+
url='https://github.com/docusealco/docuseal-python',
|
|
8
|
+
author='DocuSeal',
|
|
9
|
+
author_email='admin@docuseal.com',
|
|
10
|
+
keywords="docuseal document signature",
|
|
11
|
+
license='MIT',
|
|
12
|
+
packages=['docuseal'],
|
|
13
|
+
install_requires=[],
|
|
14
|
+
python_requires=">=3.6",
|
|
15
|
+
project_urls={
|
|
16
|
+
"Bug Tracker": "https://github.com/docuseaoco/docuseal-python/issues",
|
|
17
|
+
"Changes": "https://github.com/docuseaoco/docuseal-python/blob/master/CHANGELOG.md",
|
|
18
|
+
"Documentation": "https://www.docuseal.com/docs/api?lang=python",
|
|
19
|
+
"Source Code": "https://github.com/docuseaoco/docuseal-python",
|
|
20
|
+
},
|
|
21
|
+
classifiers=[
|
|
22
|
+
"Development Status :: 5 - Production/Stable",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"License :: OSI Approved :: MIT License",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
"Programming Language :: Python",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
29
|
+
"Programming Language :: Python :: 3.6",
|
|
30
|
+
"Programming Language :: Python :: 3.7",
|
|
31
|
+
"Programming Language :: Python :: 3.8",
|
|
32
|
+
"Programming Language :: Python :: 3.9",
|
|
33
|
+
"Programming Language :: Python :: 3.10",
|
|
34
|
+
"Programming Language :: Python :: 3.11",
|
|
35
|
+
"Programming Language :: Python :: 3.12",
|
|
36
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
37
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
38
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
39
|
+
],
|
|
40
|
+
setup_requires=["wheel"],
|
|
41
|
+
)
|