reedapt 0.1.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.
@@ -0,0 +1,7 @@
1
+ .venv/
2
+ dist/
3
+ __pycache__/
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ .mypy_cache/
7
+ .ruff_cache/
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ `dubs.transcript()`, `dubs.subtitles()` (SRT or WebVTT) and `webhook_endpoints.resend_delivery()`.
6
+
7
+ `usage.report()` for a month of minutes and dubs per key and per language.
8
+
9
+ First release: sync and asyncio clients for uploads in parts and from links, dubs, languages, usage, webhook endpoints and webhook signature checks, with retries and idempotency keys.
reedapt-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Reedapt
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.
reedapt-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.5
2
+ Name: reedapt
3
+ Version: 0.1.0
4
+ Summary: The official Python library for the Reedapt API.
5
+ Project-URL: Homepage, https://docs.reedapt.com
6
+ Project-URL: Documentation, https://docs.reedapt.com
7
+ Project-URL: Source, https://github.com/Reedapt/reedapt-python
8
+ Project-URL: Issues, https://github.com/Reedapt/reedapt-python/issues
9
+ Author-email: Reedapt <support@reedapt.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: api,dubbing,reedapt,translation,voice
13
+ Classifier: Development Status :: 4 - Beta
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.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.9
25
+ Requires-Dist: httpx<1,>=0.23
26
+ Requires-Dist: typing-extensions>=4.7
27
+ Description-Content-Type: text/markdown
28
+
29
+ # Reedapt Python library
30
+
31
+ The official Python library for the [Reedapt API](https://docs.reedapt.com). Upload video or audio, dub it into other languages in each speaker's own voice, and get the files back.
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ pip install reedapt
37
+ ```
38
+
39
+ Python 3.9 or later. Sync and asyncio clients, fully typed.
40
+
41
+ ## Quickstart
42
+
43
+ Make a key under **Developers** in [Reedapt](https://dub.reedapt.com/developers) and keep it in `REEDAPT_API_KEY`. Test keys are free and dub the first 60 seconds with a watermark.
44
+
45
+ ```python
46
+ from reedapt import Reedapt
47
+
48
+ reedapt = Reedapt() # reads REEDAPT_API_KEY
49
+
50
+ created = reedapt.dub(
51
+ "interview.mp4",
52
+ source_language="en",
53
+ target_languages=["fr", "es"],
54
+ )
55
+
56
+ for started in created["dubs"]:
57
+ dub = reedapt.dubs.wait_until_done(started["id"])
58
+ if dub["status"] == "completed":
59
+ files = reedapt.dubs.files(dub["id"])["files"]
60
+ print(dub["target_language"], files[0]["url"])
61
+ else:
62
+ print(dub["target_language"], "failed:", dub["error"]["message"])
63
+ ```
64
+
65
+ `dub()` takes a path, bytes (with `filename=`), a binary file object, or a public `https://` link that Reedapt downloads itself. In production, use [webhooks](#webhooks) instead of `wait_until_done`.
66
+
67
+ ## Async
68
+
69
+ ```python
70
+ import asyncio
71
+ from reedapt import AsyncReedapt
72
+
73
+
74
+ async def main() -> None:
75
+ async with AsyncReedapt() as reedapt:
76
+ created = await reedapt.dub("interview.mp4", source_language="en", target_languages=["fr"])
77
+ dub = await reedapt.dubs.wait_until_done(created["dubs"][0]["id"])
78
+ print(dub["status"])
79
+
80
+
81
+ asyncio.run(main())
82
+ ```
83
+
84
+ ## Uploads
85
+
86
+ `uploads.upload_file` sends the file straight to storage in parts, four at a time, signs more links as it needs them, and retries parts that fail:
87
+
88
+ ```python
89
+ upload = reedapt.uploads.upload_file(
90
+ "film.mov",
91
+ concurrency=4,
92
+ on_progress=lambda done, total: print(f"{100 * done // total}%"),
93
+ )
94
+
95
+ created = reedapt.dubs.create(
96
+ upload_id=upload["id"],
97
+ source_language="en",
98
+ target_languages=["yo"],
99
+ metadata={"order_id": "1042"},
100
+ )
101
+ ```
102
+
103
+ For a file that's already online:
104
+
105
+ ```python
106
+ upload = reedapt.uploads.from_url("https://example.com/media/talk.mp4")
107
+ ```
108
+
109
+ ## Dubs
110
+
111
+ ```python
112
+ reedapt.dubs.retrieve("job_3f9a2c7e1b4d")
113
+ reedapt.dubs.list(limit=20)
114
+ for dub in reedapt.dubs.list_all():
115
+ print(dub["id"], dub["status"])
116
+ reedapt.dubs.files("job_3f9a2c7e1b4d") # links last an hour
117
+ reedapt.dubs.cancel("job_3f9a2c7e1b4d") # minutes are returned
118
+ reedapt.dubs.transcript("job_3f9a2c7e1b4d") # every line, with timing, speaker and translation
119
+ reedapt.dubs.subtitles("job_3f9a2c7e1b4d", format="vtt") # SRT (default) or WebVTT text
120
+
121
+ reedapt.languages.list() # {"target_languages": [...]}
122
+ reedapt.usage.retrieve() # plan, key mode and minutes left
123
+ reedapt.usage.report(month="2026-10") # minutes and dubs per key and per language
124
+ ```
125
+
126
+ Results are plain dictionaries, typed with `TypedDict`s in `reedapt.types`.
127
+
128
+ ## Webhooks
129
+
130
+ Add an endpoint under **Developers**, or with `reedapt.webhook_endpoints.create(url=...)`, and keep its `whsec_` secret. `reedapt.webhook_endpoints.resend_delivery(endpoint_id, delivery_id)` sends a past delivery again. Check every delivery against the raw body:
131
+
132
+ ```python
133
+ import os
134
+ from flask import Flask, abort, request
135
+ from reedapt import WebhookVerificationError, construct_webhook_event
136
+
137
+ app = Flask(__name__)
138
+
139
+
140
+ @app.post("/reedapt/webhooks")
141
+ def reedapt_webhook():
142
+ try:
143
+ event = construct_webhook_event(
144
+ request.get_data(),
145
+ request.headers.get("Reedapt-Signature"),
146
+ os.environ["REEDAPT_WEBHOOK_SECRET"],
147
+ )
148
+ except WebhookVerificationError:
149
+ abort(400)
150
+ if event["type"] == "dub.completed":
151
+ dub = event["data"]["dub"] # queue the work, then answer quickly
152
+ return "", 200
153
+ ```
154
+
155
+ An event can arrive more than once, so skip any `event["id"]` you've already handled.
156
+
157
+ ## Errors
158
+
159
+ Failed requests raise a subclass of `APIError` with the HTTP `status`, a stable `code`, a plain-English `message` and the `request_id` to quote to support:
160
+
161
+ ```python
162
+ from reedapt import APIError, RateLimitError
163
+
164
+ try:
165
+ reedapt.dubs.create(upload_id=upload_id, source_language="en", target_languages=["fr"])
166
+ except RateLimitError as e:
167
+ if e.code == "TOO_MANY_DUBS_RUNNING":
168
+ ... # start more once some finish
169
+ except APIError as e:
170
+ print(e.status, e.code, e.message, e.request_id)
171
+ ```
172
+
173
+ | Class | When |
174
+ | --- | --- |
175
+ | `AuthenticationError` | 401: the key is missing, wrong or revoked. |
176
+ | `NotFoundError` | 404 |
177
+ | `ConflictError` | 409: the object isn't in a state that allows this. |
178
+ | `InvalidRequestError` | 400, 411, 413, 422. `fields` lists invalid fields. |
179
+ | `RateLimitError` | 429. `retry_after` is in seconds. |
180
+ | `ServerError` | 5xx |
181
+ | `ConnectionError`, `TimeoutError` | No answer arrived. |
182
+ | `UploadError` | A part couldn't be sent to storage. |
183
+ | `WaitError` | A `wait_until_…` helper ran out of time, or the upload failed. |
184
+ | `WebhookVerificationError` | A delivery's signature didn't check out. |
185
+
186
+ All of them derive from `ReedaptError`. The [error codes](https://docs.reedapt.com/errors) are listed in the docs.
187
+
188
+ ## Retries and repeated requests
189
+
190
+ Network failures, `500`, `502`, `503`, `504` and per-minute rate limits are retried twice, with backoff, honouring `Retry-After`. Creating uploads and dubs always sends an `Idempotency-Key`, so a retry never makes a second dub. Pass your own to make a repeat safe across restarts:
191
+
192
+ ```python
193
+ reedapt.dubs.create(..., idempotency_key=f"order-{order.id}")
194
+ ```
195
+
196
+ ## Configuration
197
+
198
+ ```python
199
+ reedapt = Reedapt(
200
+ api_key=os.environ["REEDAPT_API_KEY"],
201
+ timeout=60.0, # per request, in seconds
202
+ max_retries=2,
203
+ )
204
+
205
+ reedapt.dubs.retrieve(dub_id, timeout=10.0, max_retries=0)
206
+ ```
207
+
208
+ Pass `http_client=httpx.Client(...)` to set proxies or transport options. Keep keys on your server. Never put one in an app people can download.
209
+
210
+ ## Links
211
+
212
+ - [Documentation](https://docs.reedapt.com)
213
+ - [API reference](https://docs.reedapt.com/api-reference/introduction)
214
+ - [Status](https://status.reedapt.com)
215
+ - Support: support@reedapt.com
@@ -0,0 +1,187 @@
1
+ # Reedapt Python library
2
+
3
+ The official Python library for the [Reedapt API](https://docs.reedapt.com). Upload video or audio, dub it into other languages in each speaker's own voice, and get the files back.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install reedapt
9
+ ```
10
+
11
+ Python 3.9 or later. Sync and asyncio clients, fully typed.
12
+
13
+ ## Quickstart
14
+
15
+ Make a key under **Developers** in [Reedapt](https://dub.reedapt.com/developers) and keep it in `REEDAPT_API_KEY`. Test keys are free and dub the first 60 seconds with a watermark.
16
+
17
+ ```python
18
+ from reedapt import Reedapt
19
+
20
+ reedapt = Reedapt() # reads REEDAPT_API_KEY
21
+
22
+ created = reedapt.dub(
23
+ "interview.mp4",
24
+ source_language="en",
25
+ target_languages=["fr", "es"],
26
+ )
27
+
28
+ for started in created["dubs"]:
29
+ dub = reedapt.dubs.wait_until_done(started["id"])
30
+ if dub["status"] == "completed":
31
+ files = reedapt.dubs.files(dub["id"])["files"]
32
+ print(dub["target_language"], files[0]["url"])
33
+ else:
34
+ print(dub["target_language"], "failed:", dub["error"]["message"])
35
+ ```
36
+
37
+ `dub()` takes a path, bytes (with `filename=`), a binary file object, or a public `https://` link that Reedapt downloads itself. In production, use [webhooks](#webhooks) instead of `wait_until_done`.
38
+
39
+ ## Async
40
+
41
+ ```python
42
+ import asyncio
43
+ from reedapt import AsyncReedapt
44
+
45
+
46
+ async def main() -> None:
47
+ async with AsyncReedapt() as reedapt:
48
+ created = await reedapt.dub("interview.mp4", source_language="en", target_languages=["fr"])
49
+ dub = await reedapt.dubs.wait_until_done(created["dubs"][0]["id"])
50
+ print(dub["status"])
51
+
52
+
53
+ asyncio.run(main())
54
+ ```
55
+
56
+ ## Uploads
57
+
58
+ `uploads.upload_file` sends the file straight to storage in parts, four at a time, signs more links as it needs them, and retries parts that fail:
59
+
60
+ ```python
61
+ upload = reedapt.uploads.upload_file(
62
+ "film.mov",
63
+ concurrency=4,
64
+ on_progress=lambda done, total: print(f"{100 * done // total}%"),
65
+ )
66
+
67
+ created = reedapt.dubs.create(
68
+ upload_id=upload["id"],
69
+ source_language="en",
70
+ target_languages=["yo"],
71
+ metadata={"order_id": "1042"},
72
+ )
73
+ ```
74
+
75
+ For a file that's already online:
76
+
77
+ ```python
78
+ upload = reedapt.uploads.from_url("https://example.com/media/talk.mp4")
79
+ ```
80
+
81
+ ## Dubs
82
+
83
+ ```python
84
+ reedapt.dubs.retrieve("job_3f9a2c7e1b4d")
85
+ reedapt.dubs.list(limit=20)
86
+ for dub in reedapt.dubs.list_all():
87
+ print(dub["id"], dub["status"])
88
+ reedapt.dubs.files("job_3f9a2c7e1b4d") # links last an hour
89
+ reedapt.dubs.cancel("job_3f9a2c7e1b4d") # minutes are returned
90
+ reedapt.dubs.transcript("job_3f9a2c7e1b4d") # every line, with timing, speaker and translation
91
+ reedapt.dubs.subtitles("job_3f9a2c7e1b4d", format="vtt") # SRT (default) or WebVTT text
92
+
93
+ reedapt.languages.list() # {"target_languages": [...]}
94
+ reedapt.usage.retrieve() # plan, key mode and minutes left
95
+ reedapt.usage.report(month="2026-10") # minutes and dubs per key and per language
96
+ ```
97
+
98
+ Results are plain dictionaries, typed with `TypedDict`s in `reedapt.types`.
99
+
100
+ ## Webhooks
101
+
102
+ Add an endpoint under **Developers**, or with `reedapt.webhook_endpoints.create(url=...)`, and keep its `whsec_` secret. `reedapt.webhook_endpoints.resend_delivery(endpoint_id, delivery_id)` sends a past delivery again. Check every delivery against the raw body:
103
+
104
+ ```python
105
+ import os
106
+ from flask import Flask, abort, request
107
+ from reedapt import WebhookVerificationError, construct_webhook_event
108
+
109
+ app = Flask(__name__)
110
+
111
+
112
+ @app.post("/reedapt/webhooks")
113
+ def reedapt_webhook():
114
+ try:
115
+ event = construct_webhook_event(
116
+ request.get_data(),
117
+ request.headers.get("Reedapt-Signature"),
118
+ os.environ["REEDAPT_WEBHOOK_SECRET"],
119
+ )
120
+ except WebhookVerificationError:
121
+ abort(400)
122
+ if event["type"] == "dub.completed":
123
+ dub = event["data"]["dub"] # queue the work, then answer quickly
124
+ return "", 200
125
+ ```
126
+
127
+ An event can arrive more than once, so skip any `event["id"]` you've already handled.
128
+
129
+ ## Errors
130
+
131
+ Failed requests raise a subclass of `APIError` with the HTTP `status`, a stable `code`, a plain-English `message` and the `request_id` to quote to support:
132
+
133
+ ```python
134
+ from reedapt import APIError, RateLimitError
135
+
136
+ try:
137
+ reedapt.dubs.create(upload_id=upload_id, source_language="en", target_languages=["fr"])
138
+ except RateLimitError as e:
139
+ if e.code == "TOO_MANY_DUBS_RUNNING":
140
+ ... # start more once some finish
141
+ except APIError as e:
142
+ print(e.status, e.code, e.message, e.request_id)
143
+ ```
144
+
145
+ | Class | When |
146
+ | --- | --- |
147
+ | `AuthenticationError` | 401: the key is missing, wrong or revoked. |
148
+ | `NotFoundError` | 404 |
149
+ | `ConflictError` | 409: the object isn't in a state that allows this. |
150
+ | `InvalidRequestError` | 400, 411, 413, 422. `fields` lists invalid fields. |
151
+ | `RateLimitError` | 429. `retry_after` is in seconds. |
152
+ | `ServerError` | 5xx |
153
+ | `ConnectionError`, `TimeoutError` | No answer arrived. |
154
+ | `UploadError` | A part couldn't be sent to storage. |
155
+ | `WaitError` | A `wait_until_…` helper ran out of time, or the upload failed. |
156
+ | `WebhookVerificationError` | A delivery's signature didn't check out. |
157
+
158
+ All of them derive from `ReedaptError`. The [error codes](https://docs.reedapt.com/errors) are listed in the docs.
159
+
160
+ ## Retries and repeated requests
161
+
162
+ Network failures, `500`, `502`, `503`, `504` and per-minute rate limits are retried twice, with backoff, honouring `Retry-After`. Creating uploads and dubs always sends an `Idempotency-Key`, so a retry never makes a second dub. Pass your own to make a repeat safe across restarts:
163
+
164
+ ```python
165
+ reedapt.dubs.create(..., idempotency_key=f"order-{order.id}")
166
+ ```
167
+
168
+ ## Configuration
169
+
170
+ ```python
171
+ reedapt = Reedapt(
172
+ api_key=os.environ["REEDAPT_API_KEY"],
173
+ timeout=60.0, # per request, in seconds
174
+ max_retries=2,
175
+ )
176
+
177
+ reedapt.dubs.retrieve(dub_id, timeout=10.0, max_retries=0)
178
+ ```
179
+
180
+ Pass `http_client=httpx.Client(...)` to set proxies or transport options. Keep keys on your server. Never put one in an app people can download.
181
+
182
+ ## Links
183
+
184
+ - [Documentation](https://docs.reedapt.com)
185
+ - [API reference](https://docs.reedapt.com/api-reference/introduction)
186
+ - [Status](https://status.reedapt.com)
187
+ - Support: support@reedapt.com
@@ -0,0 +1,68 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.24"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "reedapt"
7
+ dynamic = ["version"]
8
+ description = "The official Python library for the Reedapt API."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.9"
13
+ authors = [{ name = "Reedapt", email = "support@reedapt.com" }]
14
+ keywords = ["reedapt", "dubbing", "translation", "voice", "api"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
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.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Typing :: Typed",
27
+ ]
28
+ dependencies = [
29
+ "httpx>=0.23,<1",
30
+ "typing_extensions>=4.7",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://docs.reedapt.com"
35
+ Documentation = "https://docs.reedapt.com"
36
+ Source = "https://github.com/Reedapt/reedapt-python"
37
+ Issues = "https://github.com/Reedapt/reedapt-python/issues"
38
+
39
+ [dependency-groups]
40
+ dev = ["pytest>=8", "pytest-asyncio>=0.23", "mypy>=1.10", "ruff>=0.6"]
41
+
42
+ [tool.hatch.version]
43
+ path = "src/reedapt/_version.py"
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/reedapt"]
47
+
48
+ [tool.hatch.build.targets.sdist]
49
+ include = ["src", "tests", "README.md", "LICENSE", "CHANGELOG.md"]
50
+
51
+ [tool.pytest.ini_options]
52
+ asyncio_mode = "auto"
53
+ testpaths = ["tests"]
54
+
55
+ [tool.mypy]
56
+ strict = true
57
+ # Results are JSON shaped as the TypedDicts in reedapt.types.
58
+ warn_return_any = false
59
+ files = ["src"]
60
+
61
+ [tool.ruff]
62
+ line-length = 120
63
+ target-version = "py39"
64
+
65
+ [tool.ruff.lint]
66
+ select = ["E", "F", "I", "B", "UP", "RUF", "SIM", "PYI"]
67
+ # typing.Optional/List/Dict stay: they also work where annotations are evaluated on 3.9.
68
+ ignore = ["UP006", "UP007", "UP035", "UP045", "RUF022"]
@@ -0,0 +1,46 @@
1
+ """The official Python library for the Reedapt API. See https://docs.reedapt.com."""
2
+
3
+ from . import types
4
+ from ._async_client import AsyncReedapt
5
+ from ._base import RequestOptions
6
+ from ._client import Reedapt
7
+ from ._errors import (
8
+ APIError,
9
+ AuthenticationError,
10
+ ConflictError,
11
+ ConnectionError,
12
+ InvalidRequestError,
13
+ NotFoundError,
14
+ RateLimitError,
15
+ ReedaptError,
16
+ ServerError,
17
+ TimeoutError,
18
+ UploadError,
19
+ WaitError,
20
+ WebhookVerificationError,
21
+ )
22
+ from ._version import __version__
23
+ from ._webhooks import construct_webhook_event, verify_webhook
24
+
25
+ __all__ = [
26
+ "Reedapt",
27
+ "AsyncReedapt",
28
+ "RequestOptions",
29
+ "types",
30
+ "verify_webhook",
31
+ "construct_webhook_event",
32
+ "ReedaptError",
33
+ "APIError",
34
+ "AuthenticationError",
35
+ "NotFoundError",
36
+ "ConflictError",
37
+ "InvalidRequestError",
38
+ "RateLimitError",
39
+ "ServerError",
40
+ "ConnectionError",
41
+ "TimeoutError",
42
+ "UploadError",
43
+ "WaitError",
44
+ "WebhookVerificationError",
45
+ "__version__",
46
+ ]