etchv-sdk 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.
- etchv_sdk-1.0.0/.gitignore +7 -0
- etchv_sdk-1.0.0/LICENSE +21 -0
- etchv_sdk-1.0.0/PKG-INFO +117 -0
- etchv_sdk-1.0.0/README.md +90 -0
- etchv_sdk-1.0.0/pyproject.toml +40 -0
- etchv_sdk-1.0.0/src/etchv/__init__.py +38 -0
- etchv_sdk-1.0.0/src/etchv/client.py +589 -0
- etchv_sdk-1.0.0/src/etchv/py.typed +0 -0
- etchv_sdk-1.0.0/tests/assets.json +27 -0
- etchv_sdk-1.0.0/tests/test_assets.py +42 -0
- etchv_sdk-1.0.0/tests/test_async.py +26 -0
- etchv_sdk-1.0.0/tests/test_client.py +136 -0
- etchv_sdk-1.0.0/tests/test_resources.py +205 -0
etchv_sdk-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Etchv
|
|
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.
|
etchv_sdk-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: etchv-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python client for the Etchv forensic watermarking API for images, PDFs and videos
|
|
5
|
+
Project-URL: Homepage, https://etchv.com/docs
|
|
6
|
+
Project-URL: Documentation, https://etchv.com/docs/sdks/python
|
|
7
|
+
Project-URL: Repository, https://github.com/etchv-labs/python-sdk
|
|
8
|
+
Project-URL: Issues, https://github.com/etchv-labs/python-sdk/issues
|
|
9
|
+
Author-email: Etchv Labs <hello@etchv.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,detection,etchv,forensic watermarking,image,invisible watermark,pdf,sdk,video,watermark,watermarking
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
20
|
+
Classifier: Topic :: Multimedia :: Video
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: <3.15,>=3.14
|
|
25
|
+
Requires-Dist: httpx<1,>=0.27
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Etchv Python SDK
|
|
29
|
+
|
|
30
|
+
Official server-side Python client for [Etchv](https://etchv.com): embed and
|
|
31
|
+
detect invisible forensic watermarks in images, PDFs and videos.
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pip install etchv-sdk
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Requires Python 3.14. Import it as `etchv`. Fully typed.
|
|
40
|
+
|
|
41
|
+
## Quickstart
|
|
42
|
+
|
|
43
|
+
Create an API key in the [Etchv dashboard](https://etchv.com/dashboard/api-keys)
|
|
44
|
+
and set `ETCHV_API_KEY` on your server. Embedding needs the `watermarks:embed`
|
|
45
|
+
scope, detection `watermarks:detect`, and both use credits.
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
import os
|
|
49
|
+
from pathlib import Path
|
|
50
|
+
from etchv import Etchv
|
|
51
|
+
|
|
52
|
+
with Etchv(os.environ["ETCHV_API_KEY"]) as client:
|
|
53
|
+
result = client.embed_image(Path("photo.jpg").read_bytes(),
|
|
54
|
+
{"recipient": "customer-123"}, filename="photo.jpg")
|
|
55
|
+
Path(result.filename).write_bytes(result.image) # write bytes as-is
|
|
56
|
+
|
|
57
|
+
detection = client.detect_image(result.image)
|
|
58
|
+
print(detection.watermarked, detection.watermark_id, detection.confidence)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Use `embed_document` / `detect_document` for PDFs and `embed_video` /
|
|
62
|
+
`detect_video` for H.264 MP4/MOV. Uploads are limited to 20 MB. Detection
|
|
63
|
+
recovers a SHA-256 digest of your data, not the data itself.
|
|
64
|
+
|
|
65
|
+
## Async jobs
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
job = client.submit_embed("documents", pdf_bytes, {"recipient": "customer-123"},
|
|
69
|
+
filename="report.pdf", idempotency_key="report-001")
|
|
70
|
+
status = client.get_job(job["request_id"]) # ["status"]: queued, running, retrying, succeeded, failed
|
|
71
|
+
result = client.get_embed_result(job["request_id"]) # waits for the file
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`submit_detection`, `get_job(..., detect=True)` and `get_detection_result` work
|
|
75
|
+
the same way. Reusing an `idempotency_key` with the same input returns the saved
|
|
76
|
+
result (kept 24 hours) without another charge.
|
|
77
|
+
|
|
78
|
+
## Also included
|
|
79
|
+
|
|
80
|
+
- API key check: `check_api_key()` (no credits used).
|
|
81
|
+
- Assets: `list_assets`, `get_asset`, `update_asset`, `download_asset`,
|
|
82
|
+
`delete_asset`, `delete_assets`.
|
|
83
|
+
- Webhooks: `create_webhook`, `list_webhooks`, `update_webhook`,
|
|
84
|
+
`delete_webhook`, `list_webhook_deliveries`, `redeliver_webhook`; verify
|
|
85
|
+
deliveries with `verify_webhook(raw_body, headers, signing_secret)`, which
|
|
86
|
+
raises `WebhookVerificationError`.
|
|
87
|
+
- Customer storage (S3, GCS, Azure): `create_storage_destination`,
|
|
88
|
+
`list_storage_destinations`, `update_storage_destination`,
|
|
89
|
+
`verify_storage_destination`, `delete_storage_destination`,
|
|
90
|
+
`create_storage_delivery`, `list_storage_deliveries`, `get_storage_delivery`,
|
|
91
|
+
`retry_storage_delivery`, `download_storage_delivery`.
|
|
92
|
+
|
|
93
|
+
## Errors
|
|
94
|
+
|
|
95
|
+
API failures raise `EtchvError` or a subclass such as `AuthenticationError`,
|
|
96
|
+
`PermissionDeniedError`, `ConflictError`, `GoneError`, `RateLimitError` or
|
|
97
|
+
`DeadlineExceededError`. Each carries `status_code`, `detail` and `request_id`
|
|
98
|
+
(quote it to support). Messages never include your API key.
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from etchv import EtchvError
|
|
102
|
+
|
|
103
|
+
try:
|
|
104
|
+
client.detect_image(image)
|
|
105
|
+
except EtchvError as error:
|
|
106
|
+
print(error.status_code, error.request_id)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Links
|
|
110
|
+
|
|
111
|
+
- Full guide: https://etchv.com/docs/sdks/python
|
|
112
|
+
- API reference: https://etchv.com/docs
|
|
113
|
+
- Support: hello@etchv.com
|
|
114
|
+
|
|
115
|
+
License: MIT (covers this SDK, not the hosted Etchv service).
|
|
116
|
+
|
|
117
|
+
Questions or bug reports: open an issue here or email hello@etchv.com.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Etchv Python SDK
|
|
2
|
+
|
|
3
|
+
Official server-side Python client for [Etchv](https://etchv.com): embed and
|
|
4
|
+
detect invisible forensic watermarks in images, PDFs and videos.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pip install etchv-sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Requires Python 3.14. Import it as `etchv`. Fully typed.
|
|
13
|
+
|
|
14
|
+
## Quickstart
|
|
15
|
+
|
|
16
|
+
Create an API key in the [Etchv dashboard](https://etchv.com/dashboard/api-keys)
|
|
17
|
+
and set `ETCHV_API_KEY` on your server. Embedding needs the `watermarks:embed`
|
|
18
|
+
scope, detection `watermarks:detect`, and both use credits.
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
import os
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
from etchv import Etchv
|
|
24
|
+
|
|
25
|
+
with Etchv(os.environ["ETCHV_API_KEY"]) as client:
|
|
26
|
+
result = client.embed_image(Path("photo.jpg").read_bytes(),
|
|
27
|
+
{"recipient": "customer-123"}, filename="photo.jpg")
|
|
28
|
+
Path(result.filename).write_bytes(result.image) # write bytes as-is
|
|
29
|
+
|
|
30
|
+
detection = client.detect_image(result.image)
|
|
31
|
+
print(detection.watermarked, detection.watermark_id, detection.confidence)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use `embed_document` / `detect_document` for PDFs and `embed_video` /
|
|
35
|
+
`detect_video` for H.264 MP4/MOV. Uploads are limited to 20 MB. Detection
|
|
36
|
+
recovers a SHA-256 digest of your data, not the data itself.
|
|
37
|
+
|
|
38
|
+
## Async jobs
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
job = client.submit_embed("documents", pdf_bytes, {"recipient": "customer-123"},
|
|
42
|
+
filename="report.pdf", idempotency_key="report-001")
|
|
43
|
+
status = client.get_job(job["request_id"]) # ["status"]: queued, running, retrying, succeeded, failed
|
|
44
|
+
result = client.get_embed_result(job["request_id"]) # waits for the file
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`submit_detection`, `get_job(..., detect=True)` and `get_detection_result` work
|
|
48
|
+
the same way. Reusing an `idempotency_key` with the same input returns the saved
|
|
49
|
+
result (kept 24 hours) without another charge.
|
|
50
|
+
|
|
51
|
+
## Also included
|
|
52
|
+
|
|
53
|
+
- API key check: `check_api_key()` (no credits used).
|
|
54
|
+
- Assets: `list_assets`, `get_asset`, `update_asset`, `download_asset`,
|
|
55
|
+
`delete_asset`, `delete_assets`.
|
|
56
|
+
- Webhooks: `create_webhook`, `list_webhooks`, `update_webhook`,
|
|
57
|
+
`delete_webhook`, `list_webhook_deliveries`, `redeliver_webhook`; verify
|
|
58
|
+
deliveries with `verify_webhook(raw_body, headers, signing_secret)`, which
|
|
59
|
+
raises `WebhookVerificationError`.
|
|
60
|
+
- Customer storage (S3, GCS, Azure): `create_storage_destination`,
|
|
61
|
+
`list_storage_destinations`, `update_storage_destination`,
|
|
62
|
+
`verify_storage_destination`, `delete_storage_destination`,
|
|
63
|
+
`create_storage_delivery`, `list_storage_deliveries`, `get_storage_delivery`,
|
|
64
|
+
`retry_storage_delivery`, `download_storage_delivery`.
|
|
65
|
+
|
|
66
|
+
## Errors
|
|
67
|
+
|
|
68
|
+
API failures raise `EtchvError` or a subclass such as `AuthenticationError`,
|
|
69
|
+
`PermissionDeniedError`, `ConflictError`, `GoneError`, `RateLimitError` or
|
|
70
|
+
`DeadlineExceededError`. Each carries `status_code`, `detail` and `request_id`
|
|
71
|
+
(quote it to support). Messages never include your API key.
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from etchv import EtchvError
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
client.detect_image(image)
|
|
78
|
+
except EtchvError as error:
|
|
79
|
+
print(error.status_code, error.request_id)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Links
|
|
83
|
+
|
|
84
|
+
- Full guide: https://etchv.com/docs/sdks/python
|
|
85
|
+
- API reference: https://etchv.com/docs
|
|
86
|
+
- Support: hello@etchv.com
|
|
87
|
+
|
|
88
|
+
License: MIT (covers this SDK, not the hosted Etchv service).
|
|
89
|
+
|
|
90
|
+
Questions or bug reports: open an issue here or email hello@etchv.com.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.26,<2"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "etchv-sdk"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Official Python client for the Etchv forensic watermarking API for images, PDFs and videos"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.14,<3.15"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{name = "Etchv Labs", email = "hello@etchv.com"}]
|
|
14
|
+
keywords = ["etchv", "watermark", "watermarking", "forensic watermarking", "invisible watermark", "image", "pdf", "video", "detection", "api", "sdk"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 5 - Production/Stable",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Topic :: Multimedia :: Graphics",
|
|
23
|
+
"Topic :: Multimedia :: Video",
|
|
24
|
+
"Topic :: Security",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
"Typing :: Typed",
|
|
27
|
+
]
|
|
28
|
+
dependencies = ["httpx>=0.27,<1"]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://etchv.com/docs"
|
|
32
|
+
Documentation = "https://etchv.com/docs/sdks/python"
|
|
33
|
+
Repository = "https://github.com/etchv-labs/python-sdk"
|
|
34
|
+
Issues = "https://github.com/etchv-labs/python-sdk/issues"
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.targets.wheel]
|
|
37
|
+
packages = ["src/etchv"]
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.sdist]
|
|
40
|
+
include = ["src/etchv", "tests", "README.md", "LICENSE", "pyproject.toml"]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Official Python client for the Etchv forensic watermarking API."""
|
|
2
|
+
from .client import (
|
|
3
|
+
__version__,
|
|
4
|
+
AuthenticationError,
|
|
5
|
+
ConflictError,
|
|
6
|
+
DeadlineExceededError,
|
|
7
|
+
DetectionResult,
|
|
8
|
+
DetectionUnit,
|
|
9
|
+
EmbedResult,
|
|
10
|
+
Etchv,
|
|
11
|
+
EtchvError,
|
|
12
|
+
GoneError,
|
|
13
|
+
NotFoundError,
|
|
14
|
+
PaymentRequiredError,
|
|
15
|
+
PermissionDeniedError,
|
|
16
|
+
RateLimitError,
|
|
17
|
+
WebhookVerificationError,
|
|
18
|
+
verify_webhook,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"__version__",
|
|
23
|
+
"Etchv",
|
|
24
|
+
"EtchvError",
|
|
25
|
+
"AuthenticationError",
|
|
26
|
+
"PaymentRequiredError",
|
|
27
|
+
"PermissionDeniedError",
|
|
28
|
+
"NotFoundError",
|
|
29
|
+
"ConflictError",
|
|
30
|
+
"GoneError",
|
|
31
|
+
"RateLimitError",
|
|
32
|
+
"DeadlineExceededError",
|
|
33
|
+
"EmbedResult",
|
|
34
|
+
"DetectionResult",
|
|
35
|
+
"DetectionUnit",
|
|
36
|
+
"WebhookVerificationError",
|
|
37
|
+
"verify_webhook",
|
|
38
|
+
]
|