pdftagger 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,36 @@
1
+ name: Publish to PyPI
2
+
3
+ # Runs when a GitHub release is published. PyPI "trusted publishing" lets this workflow upload
4
+ # without a stored token: PyPI trusts this repo, this workflow file and the `pypi` environment.
5
+ on:
6
+ release:
7
+ types: [published]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: "3.12"
17
+ - run: python -m pip install build twine
18
+ - run: python -m build
19
+ - run: python -m twine check dist/*
20
+ - uses: actions/upload-artifact@v4
21
+ with:
22
+ name: dist
23
+ path: dist/
24
+
25
+ publish:
26
+ needs: build
27
+ runs-on: ubuntu-latest
28
+ environment: pypi
29
+ permissions:
30
+ id-token: write
31
+ steps:
32
+ - uses: actions/download-artifact@v4
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,23 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - uses: actions/setup-node@v4
20
+ with:
21
+ node-version: "20"
22
+ - run: python -m pip install -e ".[dev]"
23
+ - run: python -m pytest -q
@@ -0,0 +1,12 @@
1
+ # Python build + env artifacts for the SDK
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .ruff_cache/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PDF Tagger
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,202 @@
1
+ Metadata-Version: 2.5
2
+ Name: pdftagger
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the PDF Tagger API — auto-tag PDFs for PDF/UA accessibility.
5
+ Project-URL: Homepage, https://pdf-tagger.com
6
+ Project-URL: Documentation, https://pdf-tagger.com/api/reference
7
+ Project-URL: Source, https://github.com/rachel-ackeret/pdftagger-python
8
+ Project-URL: Issues, https://github.com/rachel-ackeret/pdftagger-python/issues
9
+ Author: PDF Tagger
10
+ License: MIT License
11
+
12
+ Copyright (c) 2026 PDF Tagger
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: accessibility,auto-tag,pdf,pdf-ua,pdf/ua,sdk,section-508,tagging,wcag
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.9
39
+ Classifier: Programming Language :: Python :: 3.10
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Classifier: Programming Language :: Python :: 3.13
43
+ Classifier: Programming Language :: Python :: 3.14
44
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
45
+ Classifier: Typing :: Typed
46
+ Requires-Python: >=3.9
47
+ Requires-Dist: httpx>=0.24
48
+ Provides-Extra: dev
49
+ Requires-Dist: build>=1.0; extra == 'dev'
50
+ Requires-Dist: pytest>=7; extra == 'dev'
51
+ Requires-Dist: respx>=0.20; extra == 'dev'
52
+ Description-Content-Type: text/markdown
53
+
54
+ # pdftagger — auto-tag PDFs for accessibility from Python
55
+
56
+ Official Python SDK for the [PDF Tagger](https://pdf-tagger.com) API. Upload a PDF,
57
+ submit a tagging job, and download a **PDF/UA-tagged, accessible** PDF — with correct
58
+ reading order, headings, tables, and alt text. Tag one PDF, or up to 100 at once as a batch.
59
+
60
+ ```bash
61
+ pip install pdftagger
62
+ ```
63
+
64
+ ## How to auto-tag PDFs with the PDF Tagger SDK
65
+
66
+ Get an API key from the [Developers page](https://pdf-tagger.com/developers), then:
67
+
68
+ ```python
69
+ from pdftagger import PdfTaggerClient
70
+
71
+ client = PdfTaggerClient(api_key="sk_live_...")
72
+
73
+ # Upload, submit, and wait for the tagged PDF — one call.
74
+ job = client.tag_pdf("report.pdf", ocr=True)
75
+
76
+ # Save the accessible, tagged PDF.
77
+ client.download_result(job, "report.tagged.pdf")
78
+ ```
79
+
80
+ That's the whole flow. `tag_pdf()` uploads the file, submits the job, polls until it
81
+ finishes, and returns the completed job. Each job costs one credit per page, drawn from
82
+ the same balance as the web app.
83
+
84
+ ### Options
85
+
86
+ ```python
87
+ job = client.tag_pdf(
88
+ "scan.pdf",
89
+ ocr=True, # recover text from image-only / scanned pages
90
+ embed_fonts=True, # embed a non-embedded font where it is safe to do so
91
+ idempotency_key="order-1234", # safe to retry without double-charging
92
+ )
93
+ ```
94
+
95
+ Don't want to block? Submit and poll yourself:
96
+
97
+ ```python
98
+ job = client.tag_pdf("report.pdf", wait=False) # returns immediately
99
+ job = client.wait_for_job(job) # ...poll later
100
+ ```
101
+
102
+ ## Many PDFs at once: batches
103
+
104
+ Tag up to 100 PDFs as one batch. `tag_pdfs()` uploads every file, submits them in one
105
+ request, and waits until every job has finished:
106
+
107
+ ```python
108
+ batch = client.tag_pdfs(["a.pdf", "b.pdf", "c.pdf"], name="Q3 reports", ocr=True)
109
+
110
+ print(batch.counts) # BatchCounts(total=3, processing=0, completed=3, failed=0)
111
+ for job in batch.failed_jobs: # a failed job does not raise for a batch
112
+ print(job.filename, job.error_code, job.error_message)
113
+
114
+ client.download_batch_results(batch, "tagged/") # saves each completed PDF
115
+ ```
116
+
117
+ A batch is **all or nothing**: if any file is not a PDF, has more than 750 pages, or the
118
+ credits do not cover every page, nothing is charged and the call raises.
119
+ `BadRequestError.errors` lists each bad file by its position:
120
+
121
+ ```python
122
+ from pdftagger import BadRequestError
123
+
124
+ try:
125
+ client.submit_batch([upload_a.key, upload_b.key])
126
+ except BadRequestError as e:
127
+ for problem in e.errors: # {"index": 1, "type": "too_many_pages", "message": "..."}
128
+ print(problem["index"], problem["message"])
129
+ ```
130
+
131
+ Drive it yourself with `submit_batch()` (upload keys or `BatchItem`s), `get_batch()` and
132
+ `wait_for_batch()`. Each job in a batch is a normal job, so `get_job()`,
133
+ `get_job_result()` and `download_result()` work on it.
134
+
135
+ ## Verifying webhooks
136
+
137
+ Register a webhook endpoint on the Developers page to be notified when a job finishes.
138
+ Verify every delivery before trusting it — pass the **raw** request body:
139
+
140
+ ```python
141
+ from pdftagger import verify_signature
142
+ from pdftagger.webhooks import SIGNATURE_HEADER
143
+
144
+ event = verify_signature(
145
+ payload=raw_body_bytes, # the exact bytes you received
146
+ header=request.headers[SIGNATURE_HEADER],
147
+ secret="whsec_...", # the endpoint secret
148
+ )
149
+
150
+ if event.type == "job.completed":
151
+ url = client.get_job_result(event.job.id).result_url
152
+ elif event.type == "batch.completed":
153
+ batch = client.get_batch(event.batch.id) # every job in the batch has finished
154
+ ```
155
+
156
+ `verify_signature` recomputes the HMAC-SHA256 signature over the raw body, compares it in
157
+ constant time, and rejects a stale timestamp (replay). It raises
158
+ `WebhookVerificationError` on any failure. A delivery can arrive more than once, so
159
+ dedupe on `event.id`.
160
+
161
+ ## Low-level API
162
+
163
+ Every endpoint is available directly if you want to drive the flow yourself:
164
+
165
+ ```python
166
+ client.get_account() # account + credit balance
167
+ upload = client.create_upload("report.pdf")
168
+ client.upload_file(upload, "report.pdf")
169
+ job = client.submit_job(key=upload.key, ocr=True)
170
+ job = client.get_job(job.id) # processing / completed / failed
171
+ result = client.get_job_result(job.id) # short-lived download URL
172
+ ```
173
+
174
+ ## Errors
175
+
176
+ All errors derive from `PdfTaggerError`.
177
+
178
+ | Exception | When |
179
+ |---|---|
180
+ | `AuthenticationError` | 401 — key missing, invalid, or revoked |
181
+ | `BadRequestError` | 400 — invalid request (for a batch, `.errors` lists each bad file) |
182
+ | `InsufficientCreditsError` | 402 — not enough credits (a batch charges nothing) |
183
+ | `NotFoundError` | 404 — no such job/resource for this account |
184
+ | `ConflictError` | 409 — idempotency conflict, or result not ready |
185
+ | `RateLimitError` | 429 — rate limited (`.retry_after` seconds) |
186
+ | `JobFailed` | the job finished with a `failed` status (credits are refunded) |
187
+ | `JobTimeout` | the job, or the batch, did not finish within the poll timeout |
188
+ | `WebhookVerificationError` | a webhook signature could not be verified |
189
+
190
+ ## Requirements
191
+
192
+ - Python 3.9+
193
+ - [`httpx`](https://www.python-httpx.org/) (installed automatically)
194
+
195
+ ## Links
196
+
197
+ - API reference: https://pdf-tagger.com/api/reference
198
+ - Create an API key: https://pdf-tagger.com/developers
199
+
200
+ ## License
201
+
202
+ MIT
@@ -0,0 +1,149 @@
1
+ # pdftagger — auto-tag PDFs for accessibility from Python
2
+
3
+ Official Python SDK for the [PDF Tagger](https://pdf-tagger.com) API. Upload a PDF,
4
+ submit a tagging job, and download a **PDF/UA-tagged, accessible** PDF — with correct
5
+ reading order, headings, tables, and alt text. Tag one PDF, or up to 100 at once as a batch.
6
+
7
+ ```bash
8
+ pip install pdftagger
9
+ ```
10
+
11
+ ## How to auto-tag PDFs with the PDF Tagger SDK
12
+
13
+ Get an API key from the [Developers page](https://pdf-tagger.com/developers), then:
14
+
15
+ ```python
16
+ from pdftagger import PdfTaggerClient
17
+
18
+ client = PdfTaggerClient(api_key="sk_live_...")
19
+
20
+ # Upload, submit, and wait for the tagged PDF — one call.
21
+ job = client.tag_pdf("report.pdf", ocr=True)
22
+
23
+ # Save the accessible, tagged PDF.
24
+ client.download_result(job, "report.tagged.pdf")
25
+ ```
26
+
27
+ That's the whole flow. `tag_pdf()` uploads the file, submits the job, polls until it
28
+ finishes, and returns the completed job. Each job costs one credit per page, drawn from
29
+ the same balance as the web app.
30
+
31
+ ### Options
32
+
33
+ ```python
34
+ job = client.tag_pdf(
35
+ "scan.pdf",
36
+ ocr=True, # recover text from image-only / scanned pages
37
+ embed_fonts=True, # embed a non-embedded font where it is safe to do so
38
+ idempotency_key="order-1234", # safe to retry without double-charging
39
+ )
40
+ ```
41
+
42
+ Don't want to block? Submit and poll yourself:
43
+
44
+ ```python
45
+ job = client.tag_pdf("report.pdf", wait=False) # returns immediately
46
+ job = client.wait_for_job(job) # ...poll later
47
+ ```
48
+
49
+ ## Many PDFs at once: batches
50
+
51
+ Tag up to 100 PDFs as one batch. `tag_pdfs()` uploads every file, submits them in one
52
+ request, and waits until every job has finished:
53
+
54
+ ```python
55
+ batch = client.tag_pdfs(["a.pdf", "b.pdf", "c.pdf"], name="Q3 reports", ocr=True)
56
+
57
+ print(batch.counts) # BatchCounts(total=3, processing=0, completed=3, failed=0)
58
+ for job in batch.failed_jobs: # a failed job does not raise for a batch
59
+ print(job.filename, job.error_code, job.error_message)
60
+
61
+ client.download_batch_results(batch, "tagged/") # saves each completed PDF
62
+ ```
63
+
64
+ A batch is **all or nothing**: if any file is not a PDF, has more than 750 pages, or the
65
+ credits do not cover every page, nothing is charged and the call raises.
66
+ `BadRequestError.errors` lists each bad file by its position:
67
+
68
+ ```python
69
+ from pdftagger import BadRequestError
70
+
71
+ try:
72
+ client.submit_batch([upload_a.key, upload_b.key])
73
+ except BadRequestError as e:
74
+ for problem in e.errors: # {"index": 1, "type": "too_many_pages", "message": "..."}
75
+ print(problem["index"], problem["message"])
76
+ ```
77
+
78
+ Drive it yourself with `submit_batch()` (upload keys or `BatchItem`s), `get_batch()` and
79
+ `wait_for_batch()`. Each job in a batch is a normal job, so `get_job()`,
80
+ `get_job_result()` and `download_result()` work on it.
81
+
82
+ ## Verifying webhooks
83
+
84
+ Register a webhook endpoint on the Developers page to be notified when a job finishes.
85
+ Verify every delivery before trusting it — pass the **raw** request body:
86
+
87
+ ```python
88
+ from pdftagger import verify_signature
89
+ from pdftagger.webhooks import SIGNATURE_HEADER
90
+
91
+ event = verify_signature(
92
+ payload=raw_body_bytes, # the exact bytes you received
93
+ header=request.headers[SIGNATURE_HEADER],
94
+ secret="whsec_...", # the endpoint secret
95
+ )
96
+
97
+ if event.type == "job.completed":
98
+ url = client.get_job_result(event.job.id).result_url
99
+ elif event.type == "batch.completed":
100
+ batch = client.get_batch(event.batch.id) # every job in the batch has finished
101
+ ```
102
+
103
+ `verify_signature` recomputes the HMAC-SHA256 signature over the raw body, compares it in
104
+ constant time, and rejects a stale timestamp (replay). It raises
105
+ `WebhookVerificationError` on any failure. A delivery can arrive more than once, so
106
+ dedupe on `event.id`.
107
+
108
+ ## Low-level API
109
+
110
+ Every endpoint is available directly if you want to drive the flow yourself:
111
+
112
+ ```python
113
+ client.get_account() # account + credit balance
114
+ upload = client.create_upload("report.pdf")
115
+ client.upload_file(upload, "report.pdf")
116
+ job = client.submit_job(key=upload.key, ocr=True)
117
+ job = client.get_job(job.id) # processing / completed / failed
118
+ result = client.get_job_result(job.id) # short-lived download URL
119
+ ```
120
+
121
+ ## Errors
122
+
123
+ All errors derive from `PdfTaggerError`.
124
+
125
+ | Exception | When |
126
+ |---|---|
127
+ | `AuthenticationError` | 401 — key missing, invalid, or revoked |
128
+ | `BadRequestError` | 400 — invalid request (for a batch, `.errors` lists each bad file) |
129
+ | `InsufficientCreditsError` | 402 — not enough credits (a batch charges nothing) |
130
+ | `NotFoundError` | 404 — no such job/resource for this account |
131
+ | `ConflictError` | 409 — idempotency conflict, or result not ready |
132
+ | `RateLimitError` | 429 — rate limited (`.retry_after` seconds) |
133
+ | `JobFailed` | the job finished with a `failed` status (credits are refunded) |
134
+ | `JobTimeout` | the job, or the batch, did not finish within the poll timeout |
135
+ | `WebhookVerificationError` | a webhook signature could not be verified |
136
+
137
+ ## Requirements
138
+
139
+ - Python 3.9+
140
+ - [`httpx`](https://www.python-httpx.org/) (installed automatically)
141
+
142
+ ## Links
143
+
144
+ - API reference: https://pdf-tagger.com/api/reference
145
+ - Create an API key: https://pdf-tagger.com/developers
146
+
147
+ ## License
148
+
149
+ MIT
@@ -0,0 +1,15 @@
1
+ # Releasing
2
+
3
+ PyPI publishing is automatic: publishing a GitHub release runs `.github/workflows/publish.yml`,
4
+ which builds the package and uploads it with PyPI trusted publishing (no token).
5
+
6
+ 1. Set the new version in `src/pdftagger/_version.py` and merge it to `main`.
7
+ 2. On GitHub, create a release with the tag `v<version>` (for example `v0.1.0`) and publish it.
8
+ 3. Check the "Publish to PyPI" workflow run, then `pip install pdftagger==<version>`.
9
+
10
+ One-time setup (already done once it has been published):
11
+
12
+ - On PyPI, add a trusted publisher for the project `pdftagger`: owner `rachel-ackeret`,
13
+ repository `pdftagger-python`, workflow `publish.yml`, environment `pypi`. Before the first
14
+ release this is a "pending publisher" (Account settings → Publishing).
15
+ - On GitHub, create the environment `pypi` (Settings → Environments).
@@ -0,0 +1,45 @@
1
+ """Tag a PDF and save the accessible result.
2
+
3
+ Usage:
4
+ export PDFTAGGER_API_KEY=sk_live_...
5
+ python quickstart.py report.pdf
6
+ """
7
+
8
+ import os
9
+ import sys
10
+
11
+ from pdftagger import JobFailed, JobTimeout, PdfTaggerClient
12
+
13
+
14
+ def main() -> int:
15
+ if len(sys.argv) < 2:
16
+ print("usage: python quickstart.py <file.pdf>", file=sys.stderr)
17
+ return 2
18
+
19
+ api_key = os.environ.get("PDFTAGGER_API_KEY")
20
+ if not api_key:
21
+ print("set PDFTAGGER_API_KEY first", file=sys.stderr)
22
+ return 2
23
+
24
+ source = sys.argv[1]
25
+ out = source.rsplit(".", 1)[0] + ".tagged.pdf"
26
+
27
+ with PdfTaggerClient(api_key=api_key) as client:
28
+ account = client.get_account()
29
+ print(f"Credits available: {account.credits_available}")
30
+ try:
31
+ job = client.tag_pdf(source, ocr=True)
32
+ except JobFailed as exc:
33
+ print(f"Job failed: {exc}", file=sys.stderr)
34
+ return 1
35
+ except JobTimeout as exc:
36
+ print(f"Timed out waiting: {exc}", file=sys.stderr)
37
+ return 1
38
+
39
+ client.download_result(job, out)
40
+ print(f"Tagged PDF saved to {out} (job {job.id}, {job.credits_used} credits)")
41
+ return 0
42
+
43
+
44
+ if __name__ == "__main__":
45
+ raise SystemExit(main())
@@ -0,0 +1,46 @@
1
+ """Receive and verify PDF Tagger webhooks with Flask.
2
+
3
+ Usage:
4
+ export PDFTAGGER_WEBHOOK_SECRET=whsec_...
5
+ pip install flask
6
+ flask --app webhook_flask run
7
+ """
8
+
9
+ import os
10
+
11
+ from flask import Flask, request
12
+
13
+ from pdftagger import WebhookVerificationError, verify_signature
14
+ from pdftagger.webhooks import SIGNATURE_HEADER
15
+
16
+ app = Flask(__name__)
17
+ SECRET = os.environ["PDFTAGGER_WEBHOOK_SECRET"]
18
+
19
+ # Remember handled events — deliveries can arrive more than once.
20
+ _seen: set[str] = set()
21
+
22
+
23
+ @app.post("/webhooks/pdftagger")
24
+ def receive():
25
+ try:
26
+ event = verify_signature(
27
+ payload=request.get_data(), # raw bytes — do NOT use request.json here
28
+ header=request.headers.get(SIGNATURE_HEADER),
29
+ secret=SECRET,
30
+ )
31
+ except WebhookVerificationError:
32
+ return "", 400
33
+
34
+ if event.id in _seen:
35
+ return "", 200 # already handled: a retried delivery keeps the same event id
36
+ _seen.add(event.id)
37
+
38
+ if event.type == "job.completed":
39
+ print(f"Job {event.job.id} completed — fetch its result URL to download.")
40
+ elif event.type == "job.failed":
41
+ print(f"Job {event.job.id} failed: {event.job.error_message}")
42
+ elif event.type == "batch.completed":
43
+ b = event.batch
44
+ print(f"Batch {b.id} finished: {b.completed} completed, {b.failed} failed.")
45
+
46
+ return "", 200
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pdftagger"
7
+ dynamic = ["version"]
8
+ description = "Official Python SDK for the PDF Tagger API — auto-tag PDFs for PDF/UA accessibility."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "PDF Tagger" }]
13
+ keywords = [
14
+ "pdf",
15
+ "accessibility",
16
+ "pdf-ua",
17
+ "pdf/ua",
18
+ "auto-tag",
19
+ "tagging",
20
+ "section-508",
21
+ "wcag",
22
+ "sdk",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Developers",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Operating System :: OS Independent",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3.9",
31
+ "Programming Language :: Python :: 3.10",
32
+ "Programming Language :: Python :: 3.11",
33
+ "Programming Language :: Python :: 3.12",
34
+ "Programming Language :: Python :: 3.13",
35
+ "Programming Language :: Python :: 3.14",
36
+ "Topic :: Software Development :: Libraries :: Python Modules",
37
+ "Typing :: Typed",
38
+ ]
39
+ dependencies = ["httpx>=0.24"]
40
+
41
+ [project.optional-dependencies]
42
+ dev = ["pytest>=7", "respx>=0.20", "build>=1.0"]
43
+
44
+ [project.urls]
45
+ Homepage = "https://pdf-tagger.com"
46
+ Documentation = "https://pdf-tagger.com/api/reference"
47
+ Source = "https://github.com/rachel-ackeret/pdftagger-python"
48
+ Issues = "https://github.com/rachel-ackeret/pdftagger-python/issues"
49
+
50
+ [tool.hatch.version]
51
+ path = "src/pdftagger/_version.py"
52
+
53
+ [tool.hatch.build.targets.wheel]
54
+ packages = ["src/pdftagger"]
55
+
56
+ [tool.pytest.ini_options]
57
+ testpaths = ["tests"]
@@ -0,0 +1,65 @@
1
+ """Official Python SDK for the PDF Tagger API.
2
+
3
+ Auto-tag PDFs for PDF/UA accessibility from your own code:
4
+
5
+ >>> from pdftagger import PdfTaggerClient
6
+ >>> client = PdfTaggerClient(api_key="sk_live_...")
7
+ >>> job = client.tag_pdf("report.pdf", ocr=True)
8
+ >>> client.download_result(job, "report.tagged.pdf")
9
+
10
+ Many PDFs at once, as one batch:
11
+
12
+ >>> batch = client.tag_pdfs(["a.pdf", "b.pdf", "c.pdf"])
13
+ >>> client.download_batch_results(batch, "tagged/")
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ from ._version import __version__
19
+ from .client import DEFAULT_BASE_URL, PdfTaggerClient
20
+ from .exceptions import (
21
+ APIError,
22
+ AuthenticationError,
23
+ BadRequestError,
24
+ ConflictError,
25
+ InsufficientCreditsError,
26
+ JobFailed,
27
+ JobTimeout,
28
+ NotFoundError,
29
+ PdfTaggerError,
30
+ RateLimitError,
31
+ WebhookVerificationError,
32
+ )
33
+ from .models import Account, Batch, BatchCounts, BatchEvent, BatchItem, Job, JobResult, Upload, WebhookEvent
34
+ from .webhooks import SIGNATURE_HEADER, verify_signature
35
+
36
+ __all__ = [
37
+ "__version__",
38
+ "PdfTaggerClient",
39
+ "DEFAULT_BASE_URL",
40
+ # models
41
+ "Account",
42
+ "Upload",
43
+ "Job",
44
+ "JobResult",
45
+ "Batch",
46
+ "BatchItem",
47
+ "BatchCounts",
48
+ "BatchEvent",
49
+ "WebhookEvent",
50
+ # webhooks
51
+ "verify_signature",
52
+ "SIGNATURE_HEADER",
53
+ # exceptions
54
+ "PdfTaggerError",
55
+ "APIError",
56
+ "BadRequestError",
57
+ "AuthenticationError",
58
+ "InsufficientCreditsError",
59
+ "NotFoundError",
60
+ "ConflictError",
61
+ "RateLimitError",
62
+ "JobTimeout",
63
+ "JobFailed",
64
+ "WebhookVerificationError",
65
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"