pdfdancer-client-python 0.3.4__tar.gz → 0.3.5__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.
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/CLAUDE.md +1 -1
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/PKG-INFO +7 -7
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/README.md +6 -6
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/pyproject.toml +1 -1
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/pdfdancer_v1.py +15 -8
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer_client_python.egg-info/PKG-INFO +7 -7
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/test.sh +10 -6
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/__init__.py +3 -2
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_pdfdancer.py +8 -2
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_anonymous_token.py +25 -5
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/.claude/commands/discuss.md +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/.claude/commands/implement-new-api-features.md +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/.flake8 +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/.github/workflows/ci.yml +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/.github/workflows/daily-tests.yml +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/.gitignore +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/LICENSE +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/NOTICE +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/TODO.md +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/check.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/docs/api-schemas/v0.yml +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/docs/api-schemas/v1.yml +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/media/logo-orange-512h.webp +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/media/logo-orange-60h.webp +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/release.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/setup.cfg +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/__init__.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/exceptions.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/fingerprint.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/image_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/models.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/page_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/paragraph_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/path_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/text_line_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/types.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer_client_python.egg-info/SOURCES.txt +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer_client_python.egg-info/dependency_links.txt +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer_client_python.egg-info/requires.txt +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer_client_python.egg-info/top_level.txt +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/__init__.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/conftest.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/pdf_assertions.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_acroform.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_bezier_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_context_manager.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_form_x_objects.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_image.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_image_transform.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_line.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_line_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_new_pdf.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_page.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_paragraph.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_path.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_path_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_path_builder_rectangle.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_path_comprehensive.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_positioning.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_rectangle_builder.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_redact.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_singular_selection.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_snapshot.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_text_line_edit.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/DancingScript-Regular.ttf +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/Empty.pdf +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/JetBrainsMono-Regular.ttf +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/Showcase.pdf +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/basic-paths.pdf +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/form-xobject-example.pdf +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/logo-80.png +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/mixed-form-types.pdf +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_fingerprint.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_models.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_openapi_compliance.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_path_models.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_pdf_object_equality.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_rate_limit.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_standard_fonts.py +0 -0
- {pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/update-api-spec.sh +0 -0
|
@@ -95,7 +95,7 @@ pdf.save("output.pdf")
|
|
|
95
95
|
### Initialization
|
|
96
96
|
|
|
97
97
|
```python
|
|
98
|
-
# Open existing PDF with token from env var
|
|
98
|
+
# Open existing PDF with token from env var PDFDANCER_API_TOKEN
|
|
99
99
|
pdf = PDFDancer.open(pdf_data="document.pdf")
|
|
100
100
|
|
|
101
101
|
# Open with explicit token
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdfdancer-client-python
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: Python client for PDFDancer API
|
|
5
5
|
Author-email: "The Famous Cat Ltd." <hi@thefamouscat.com>
|
|
6
6
|
License:
|
|
@@ -289,7 +289,7 @@ from pdfdancer import Color, PDFDancer, StandardFonts
|
|
|
289
289
|
|
|
290
290
|
with PDFDancer.open(
|
|
291
291
|
pdf_data=Path("input.pdf"),
|
|
292
|
-
token="your-api-token", # optional when
|
|
292
|
+
token="your-api-token", # optional when PDFDANCER_API_TOKEN is set
|
|
293
293
|
base_url="https://api.pdfdancer.com",
|
|
294
294
|
) as pdf:
|
|
295
295
|
# Locate and update an existing paragraph
|
|
@@ -443,7 +443,7 @@ with PDFDancer.open("confidential.pdf") as pdf:
|
|
|
443
443
|
|
|
444
444
|
## Configuration
|
|
445
445
|
|
|
446
|
-
- Set `
|
|
446
|
+
- Set `PDFDANCER_API_TOKEN` for authentication (preferred). `PDFDANCER_TOKEN` is also supported for backwards compatibility.
|
|
447
447
|
- Override the API host with `PDFDANCER_BASE_URL` (e.g., sandbox or local environments). Defaults to `https://api.pdfdancer.com`.
|
|
448
448
|
- Tune HTTP read timeouts via the `timeout` argument on `PDFDancer.open()` and `PDFDancer.new()` (default: 30 seconds).
|
|
449
449
|
- For testing against self-signed certificates, call `pdfdancer.set_ssl_verify(False)` to temporarily disable TLS verification.
|
|
@@ -513,13 +513,13 @@ Set your PDFDancer API token as an environment variable:
|
|
|
513
513
|
|
|
514
514
|
```bash
|
|
515
515
|
# On macOS/Linux:
|
|
516
|
-
export
|
|
516
|
+
export PDFDANCER_API_TOKEN="your-api-token-here"
|
|
517
517
|
|
|
518
518
|
# On Windows (Command Prompt):
|
|
519
|
-
set
|
|
519
|
+
set PDFDANCER_API_TOKEN=your-api-token-here
|
|
520
520
|
|
|
521
521
|
# On Windows (PowerShell):
|
|
522
|
-
$env:
|
|
522
|
+
$env:PDFDANCER_API_TOKEN="your-api-token-here"
|
|
523
523
|
```
|
|
524
524
|
|
|
525
525
|
For permanent configuration, add this to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.).
|
|
@@ -651,7 +651,7 @@ pip install -e .
|
|
|
651
651
|
|
|
652
652
|
#### Test Failures
|
|
653
653
|
|
|
654
|
-
- Ensure `
|
|
654
|
+
- Ensure `PDFDANCER_API_TOKEN` is set for e2e tests
|
|
655
655
|
- Check network connectivity to the PDFDancer API
|
|
656
656
|
- Verify you're using Python 3.10 or higher
|
|
657
657
|
|
|
@@ -50,7 +50,7 @@ from pdfdancer import Color, PDFDancer, StandardFonts
|
|
|
50
50
|
|
|
51
51
|
with PDFDancer.open(
|
|
52
52
|
pdf_data=Path("input.pdf"),
|
|
53
|
-
token="your-api-token", # optional when
|
|
53
|
+
token="your-api-token", # optional when PDFDANCER_API_TOKEN is set
|
|
54
54
|
base_url="https://api.pdfdancer.com",
|
|
55
55
|
) as pdf:
|
|
56
56
|
# Locate and update an existing paragraph
|
|
@@ -204,7 +204,7 @@ with PDFDancer.open("confidential.pdf") as pdf:
|
|
|
204
204
|
|
|
205
205
|
## Configuration
|
|
206
206
|
|
|
207
|
-
- Set `
|
|
207
|
+
- Set `PDFDANCER_API_TOKEN` for authentication (preferred). `PDFDANCER_TOKEN` is also supported for backwards compatibility.
|
|
208
208
|
- Override the API host with `PDFDANCER_BASE_URL` (e.g., sandbox or local environments). Defaults to `https://api.pdfdancer.com`.
|
|
209
209
|
- Tune HTTP read timeouts via the `timeout` argument on `PDFDancer.open()` and `PDFDancer.new()` (default: 30 seconds).
|
|
210
210
|
- For testing against self-signed certificates, call `pdfdancer.set_ssl_verify(False)` to temporarily disable TLS verification.
|
|
@@ -274,13 +274,13 @@ Set your PDFDancer API token as an environment variable:
|
|
|
274
274
|
|
|
275
275
|
```bash
|
|
276
276
|
# On macOS/Linux:
|
|
277
|
-
export
|
|
277
|
+
export PDFDANCER_API_TOKEN="your-api-token-here"
|
|
278
278
|
|
|
279
279
|
# On Windows (Command Prompt):
|
|
280
|
-
set
|
|
280
|
+
set PDFDANCER_API_TOKEN=your-api-token-here
|
|
281
281
|
|
|
282
282
|
# On Windows (PowerShell):
|
|
283
|
-
$env:
|
|
283
|
+
$env:PDFDANCER_API_TOKEN="your-api-token-here"
|
|
284
284
|
```
|
|
285
285
|
|
|
286
286
|
For permanent configuration, add this to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.).
|
|
@@ -412,7 +412,7 @@ pip install -e .
|
|
|
412
412
|
|
|
413
413
|
#### Test Failures
|
|
414
414
|
|
|
415
|
-
- Ensure `
|
|
415
|
+
- Ensure `PDFDANCER_API_TOKEN` is set for e2e tests
|
|
416
416
|
- Check network connectivity to the PDFDancer API
|
|
417
417
|
- Verify you're using Python 3.10 or higher
|
|
418
418
|
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/pdfdancer_v1.py
RENAMED
|
@@ -690,13 +690,14 @@ class PDFDancer:
|
|
|
690
690
|
|
|
691
691
|
Authentication:
|
|
692
692
|
- If token is provided, uses it
|
|
693
|
-
- Otherwise, checks
|
|
693
|
+
- Otherwise, checks PDFDANCER_API_TOKEN environment variable (preferred)
|
|
694
|
+
- Falls back to PDFDANCER_TOKEN environment variable (legacy)
|
|
694
695
|
- If no token is found, automatically obtains an anonymous token
|
|
695
696
|
|
|
696
697
|
Args:
|
|
697
698
|
pdf_data: PDF payload supplied directly or via filesystem handles.
|
|
698
|
-
token: Override for the API token; falls back to `
|
|
699
|
-
then to anonymous token if not set.
|
|
699
|
+
token: Override for the API token; falls back to `PDFDANCER_API_TOKEN` or
|
|
700
|
+
`PDFDANCER_TOKEN` environment variable, then to anonymous token if not set.
|
|
700
701
|
base_url: Override for the API base URL; falls back to `PDFDANCER_BASE_URL`
|
|
701
702
|
or defaults to `https://api.pdfdancer.com`.
|
|
702
703
|
timeout: HTTP read timeout in seconds.
|
|
@@ -856,10 +857,15 @@ class PDFDancer:
|
|
|
856
857
|
"""
|
|
857
858
|
Resolve token from argument or environment variable.
|
|
858
859
|
Returns None if no token is found (allowing fallback to anonymous token).
|
|
860
|
+
|
|
861
|
+
Checks environment variables in order:
|
|
862
|
+
1. PDFDANCER_API_TOKEN (preferred)
|
|
863
|
+
2. PDFDANCER_TOKEN (legacy)
|
|
859
864
|
"""
|
|
860
865
|
resolved_token = token.strip() if token and token.strip() else None
|
|
861
866
|
if resolved_token is None:
|
|
862
|
-
|
|
867
|
+
# Check PDFDANCER_API_TOKEN first (preferred), then PDFDANCER_TOKEN (legacy)
|
|
868
|
+
env_token = os.getenv("PDFDANCER_API_TOKEN") or os.getenv("PDFDANCER_TOKEN")
|
|
863
869
|
resolved_token = (
|
|
864
870
|
env_token.strip() if env_token and env_token.strip() else None
|
|
865
871
|
)
|
|
@@ -882,12 +888,13 @@ class PDFDancer:
|
|
|
882
888
|
|
|
883
889
|
Authentication:
|
|
884
890
|
- If token is provided, uses it
|
|
885
|
-
- Otherwise, checks
|
|
891
|
+
- Otherwise, checks PDFDANCER_API_TOKEN environment variable (preferred)
|
|
892
|
+
- Falls back to PDFDANCER_TOKEN environment variable (legacy)
|
|
886
893
|
- If no token is found, automatically obtains an anonymous token
|
|
887
894
|
|
|
888
895
|
Args:
|
|
889
|
-
token: Override for the API token; falls back to `
|
|
890
|
-
then to anonymous token if not set.
|
|
896
|
+
token: Override for the API token; falls back to `PDFDANCER_API_TOKEN` or
|
|
897
|
+
`PDFDANCER_TOKEN` environment variable, then to anonymous token if not set.
|
|
891
898
|
base_url: Override for the API base URL; falls back to `PDFDANCER_BASE_URL`
|
|
892
899
|
or defaults to `https://api.pdfdancer.com`.
|
|
893
900
|
timeout: HTTP read timeout in seconds.
|
|
@@ -1101,7 +1108,7 @@ class PDFDancer:
|
|
|
1101
1108
|
raise ValidationException(
|
|
1102
1109
|
"Authentication with the PDFDancer API failed. "
|
|
1103
1110
|
"Confirm that your API token is valid, has not expired, and is supplied via "
|
|
1104
|
-
"the `token` argument or the
|
|
1111
|
+
"the `token` argument or the PDFDANCER_API_TOKEN environment variable. "
|
|
1105
1112
|
f"Server response: {details}"
|
|
1106
1113
|
)
|
|
1107
1114
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdfdancer-client-python
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: Python client for PDFDancer API
|
|
5
5
|
Author-email: "The Famous Cat Ltd." <hi@thefamouscat.com>
|
|
6
6
|
License:
|
|
@@ -289,7 +289,7 @@ from pdfdancer import Color, PDFDancer, StandardFonts
|
|
|
289
289
|
|
|
290
290
|
with PDFDancer.open(
|
|
291
291
|
pdf_data=Path("input.pdf"),
|
|
292
|
-
token="your-api-token", # optional when
|
|
292
|
+
token="your-api-token", # optional when PDFDANCER_API_TOKEN is set
|
|
293
293
|
base_url="https://api.pdfdancer.com",
|
|
294
294
|
) as pdf:
|
|
295
295
|
# Locate and update an existing paragraph
|
|
@@ -443,7 +443,7 @@ with PDFDancer.open("confidential.pdf") as pdf:
|
|
|
443
443
|
|
|
444
444
|
## Configuration
|
|
445
445
|
|
|
446
|
-
- Set `
|
|
446
|
+
- Set `PDFDANCER_API_TOKEN` for authentication (preferred). `PDFDANCER_TOKEN` is also supported for backwards compatibility.
|
|
447
447
|
- Override the API host with `PDFDANCER_BASE_URL` (e.g., sandbox or local environments). Defaults to `https://api.pdfdancer.com`.
|
|
448
448
|
- Tune HTTP read timeouts via the `timeout` argument on `PDFDancer.open()` and `PDFDancer.new()` (default: 30 seconds).
|
|
449
449
|
- For testing against self-signed certificates, call `pdfdancer.set_ssl_verify(False)` to temporarily disable TLS verification.
|
|
@@ -513,13 +513,13 @@ Set your PDFDancer API token as an environment variable:
|
|
|
513
513
|
|
|
514
514
|
```bash
|
|
515
515
|
# On macOS/Linux:
|
|
516
|
-
export
|
|
516
|
+
export PDFDANCER_API_TOKEN="your-api-token-here"
|
|
517
517
|
|
|
518
518
|
# On Windows (Command Prompt):
|
|
519
|
-
set
|
|
519
|
+
set PDFDANCER_API_TOKEN=your-api-token-here
|
|
520
520
|
|
|
521
521
|
# On Windows (PowerShell):
|
|
522
|
-
$env:
|
|
522
|
+
$env:PDFDANCER_API_TOKEN="your-api-token-here"
|
|
523
523
|
```
|
|
524
524
|
|
|
525
525
|
For permanent configuration, add this to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.).
|
|
@@ -651,7 +651,7 @@ pip install -e .
|
|
|
651
651
|
|
|
652
652
|
#### Test Failures
|
|
653
653
|
|
|
654
|
-
- Ensure `
|
|
654
|
+
- Ensure `PDFDANCER_API_TOKEN` is set for e2e tests
|
|
655
655
|
- Check network connectivity to the PDFDancer API
|
|
656
656
|
- Verify you're using Python 3.10 or higher
|
|
657
657
|
|
|
@@ -162,7 +162,8 @@ LONG OPTIONS (use either format):
|
|
|
162
162
|
--help Show this help message
|
|
163
163
|
|
|
164
164
|
ENVIRONMENT:
|
|
165
|
-
|
|
165
|
+
PDFDANCER_API_TOKEN Token if --token/-t not provided (preferred)
|
|
166
|
+
PDFDANCER_TOKEN Token if --token/-t not provided (legacy fallback)
|
|
166
167
|
|
|
167
168
|
SERVER URL FORMATS:
|
|
168
169
|
localhost:8080 Hostname with port (auto-detects https)
|
|
@@ -300,8 +301,11 @@ validate_args() {
|
|
|
300
301
|
fi
|
|
301
302
|
|
|
302
303
|
# Check for token (optional - use from args or environment)
|
|
304
|
+
# Priority: --token arg > PDFDANCER_API_TOKEN > PDFDANCER_TOKEN
|
|
303
305
|
if [[ -z "$TOKEN" ]]; then
|
|
304
|
-
if [[ -n "${
|
|
306
|
+
if [[ -n "${PDFDANCER_API_TOKEN:-}" ]]; then
|
|
307
|
+
TOKEN="$PDFDANCER_API_TOKEN"
|
|
308
|
+
elif [[ -n "${PDFDANCER_TOKEN:-}" ]]; then
|
|
305
309
|
TOKEN="$PDFDANCER_TOKEN"
|
|
306
310
|
else
|
|
307
311
|
TOKEN=""
|
|
@@ -374,7 +378,7 @@ run_pytest_with_gnu_parallel() {
|
|
|
374
378
|
echo " • Use -S/--stdout for live logs"
|
|
375
379
|
|
|
376
380
|
# Set environment variables for this test run
|
|
377
|
-
export
|
|
381
|
+
export PDFDANCER_API_TOKEN="$TOKEN"
|
|
378
382
|
export PDFDANCER_BASE_URL="$server_url"
|
|
379
383
|
|
|
380
384
|
# Get list of test files to distribute across workers
|
|
@@ -431,11 +435,11 @@ run_pytest_on_server() {
|
|
|
431
435
|
log_message "$server" "Starting pytest with $PARALLEL workers"
|
|
432
436
|
log_message "$server" "Server URL: $server_url"
|
|
433
437
|
log_message "$server" "Pytest args: ${PYTEST_ARGS[*]:-tests/ -v}"
|
|
434
|
-
|
|
438
|
+
|
|
435
439
|
# Set environment variables for this test run
|
|
436
|
-
export
|
|
440
|
+
export PDFDANCER_API_TOKEN="$TOKEN"
|
|
437
441
|
export PDFDANCER_BASE_URL="$server_url"
|
|
438
|
-
|
|
442
|
+
|
|
439
443
|
# Determine python executable (prefer venv if available)
|
|
440
444
|
local python_cmd="${PYTHON_CMD:-python}"
|
|
441
445
|
|
|
@@ -11,7 +11,8 @@ def _get_base_url():
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def _read_token() -> str | None:
|
|
14
|
-
|
|
14
|
+
# Check PDFDANCER_API_TOKEN first (preferred), then PDFDANCER_TOKEN (legacy)
|
|
15
|
+
token = os.getenv("PDFDANCER_API_TOKEN") or os.getenv("PDFDANCER_TOKEN")
|
|
15
16
|
if token:
|
|
16
17
|
return token.strip()
|
|
17
18
|
# Try common token files in repo
|
|
@@ -53,6 +54,6 @@ def _require_env() -> tuple[str, str | None]:
|
|
|
53
54
|
)
|
|
54
55
|
if not token:
|
|
55
56
|
pytest.fail(
|
|
56
|
-
"
|
|
57
|
+
"PDFDANCER_API_TOKEN not set and no token file found; set env or place jwt-token-*.txt in repo"
|
|
57
58
|
)
|
|
58
59
|
return base_url, token
|
|
@@ -9,19 +9,21 @@ from tests.e2e import _require_env_and_fixture
|
|
|
9
9
|
def test_env_vars():
|
|
10
10
|
base_url, _, pdf_path = _require_env_and_fixture("Showcase.pdf")
|
|
11
11
|
original_base_url_env = os.environ.get("PDFDANCER_BASE_URL")
|
|
12
|
+
original_api_token_env = os.environ.get("PDFDANCER_API_TOKEN")
|
|
12
13
|
original_token_env = os.environ.get("PDFDANCER_TOKEN")
|
|
13
14
|
try:
|
|
15
|
+
os.environ.pop("PDFDANCER_API_TOKEN", None)
|
|
14
16
|
os.environ.pop("PDFDANCER_TOKEN", None)
|
|
15
17
|
|
|
16
18
|
# With the anonymous token fallback, opening without a token should now succeed
|
|
17
19
|
# (it will automatically obtain an anonymous token)
|
|
18
|
-
# This test now verifies that the client works without
|
|
20
|
+
# This test now verifies that the client works without PDFDANCER_API_TOKEN set
|
|
19
21
|
with PDFDancer.open(pdf_path, base_url=base_url) as pdf:
|
|
20
22
|
# Verify we got a valid session
|
|
21
23
|
assert pdf._session_id is not None
|
|
22
24
|
assert pdf._token is not None # Should have obtained an anonymous token
|
|
23
25
|
|
|
24
|
-
os.environ["
|
|
26
|
+
os.environ["PDFDANCER_API_TOKEN"] = "42"
|
|
25
27
|
with PDFDancer.open(pdf_path, base_url=base_url) as pdf:
|
|
26
28
|
pass
|
|
27
29
|
|
|
@@ -43,6 +45,10 @@ def test_env_vars():
|
|
|
43
45
|
os.environ["PDFDANCER_BASE_URL"] = original_base_url_env
|
|
44
46
|
elif "PDFDANCER_BASE_URL" in os.environ:
|
|
45
47
|
del os.environ["PDFDANCER_BASE_URL"]
|
|
48
|
+
if original_api_token_env is not None:
|
|
49
|
+
os.environ["PDFDANCER_API_TOKEN"] = original_api_token_env
|
|
50
|
+
elif "PDFDANCER_API_TOKEN" in os.environ:
|
|
51
|
+
del os.environ["PDFDANCER_API_TOKEN"]
|
|
46
52
|
if original_token_env is not None:
|
|
47
53
|
os.environ["PDFDANCER_TOKEN"] = original_token_env
|
|
48
54
|
elif "PDFDANCER_TOKEN" in os.environ:
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_anonymous_token.py
RENAMED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Tests for anonymous token fallback functionality.
|
|
3
3
|
|
|
4
4
|
These tests verify that the PDFDancer client can automatically obtain
|
|
5
|
-
anonymous tokens when no PDFDANCER_TOKEN is provided,
|
|
6
|
-
behavior of the Java client.
|
|
5
|
+
anonymous tokens when no PDFDANCER_API_TOKEN or PDFDANCER_TOKEN is provided,
|
|
6
|
+
matching the behavior of the Java client.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
import os
|
|
@@ -16,7 +16,7 @@ from pdfdancer.exceptions import HttpClientException
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class TestAnonymousTokenFallback:
|
|
19
|
-
"""Test anonymous token fallback when PDFDANCER_TOKEN is not set."""
|
|
19
|
+
"""Test anonymous token fallback when PDFDANCER_API_TOKEN or PDFDANCER_TOKEN is not set."""
|
|
20
20
|
|
|
21
21
|
@pytest.fixture
|
|
22
22
|
def mock_httpx_client(self):
|
|
@@ -28,13 +28,18 @@ class TestAnonymousTokenFallback:
|
|
|
28
28
|
|
|
29
29
|
@pytest.fixture
|
|
30
30
|
def clear_env_token(self):
|
|
31
|
-
"""Temporarily clear PDFDANCER_TOKEN from environment."""
|
|
31
|
+
"""Temporarily clear PDFDANCER_TOKEN and PDFDANCER_API_TOKEN from environment."""
|
|
32
32
|
original_token = os.environ.get("PDFDANCER_TOKEN")
|
|
33
|
+
original_api_token = os.environ.get("PDFDANCER_API_TOKEN")
|
|
33
34
|
if "PDFDANCER_TOKEN" in os.environ:
|
|
34
35
|
del os.environ["PDFDANCER_TOKEN"]
|
|
36
|
+
if "PDFDANCER_API_TOKEN" in os.environ:
|
|
37
|
+
del os.environ["PDFDANCER_API_TOKEN"]
|
|
35
38
|
yield
|
|
36
39
|
if original_token is not None:
|
|
37
40
|
os.environ["PDFDANCER_TOKEN"] = original_token
|
|
41
|
+
if original_api_token is not None:
|
|
42
|
+
os.environ["PDFDANCER_API_TOKEN"] = original_api_token
|
|
38
43
|
|
|
39
44
|
def test_resolve_token_returns_none_when_no_token(self, clear_env_token):
|
|
40
45
|
"""Test that _resolve_token returns None when no token is available."""
|
|
@@ -49,10 +54,25 @@ class TestAnonymousTokenFallback:
|
|
|
49
54
|
|
|
50
55
|
def test_resolve_token_uses_env_token(self):
|
|
51
56
|
"""Test that _resolve_token uses PDFDANCER_TOKEN from environment."""
|
|
52
|
-
with patch.dict(os.environ, {"PDFDANCER_TOKEN": "env-token-456"}):
|
|
57
|
+
with patch.dict(os.environ, {"PDFDANCER_TOKEN": "env-token-456"}, clear=True):
|
|
53
58
|
result = PDFDancer._resolve_token(None)
|
|
54
59
|
assert result == "env-token-456"
|
|
55
60
|
|
|
61
|
+
def test_resolve_token_uses_api_token_env_var(self):
|
|
62
|
+
"""Test that _resolve_token uses PDFDANCER_API_TOKEN from environment."""
|
|
63
|
+
with patch.dict(os.environ, {"PDFDANCER_API_TOKEN": "api-token-789"}, clear=True):
|
|
64
|
+
result = PDFDancer._resolve_token(None)
|
|
65
|
+
assert result == "api-token-789"
|
|
66
|
+
|
|
67
|
+
def test_resolve_token_prefers_api_token_over_legacy_token(self):
|
|
68
|
+
"""Test that PDFDANCER_API_TOKEN takes precedence over PDFDANCER_TOKEN."""
|
|
69
|
+
with patch.dict(
|
|
70
|
+
os.environ,
|
|
71
|
+
{"PDFDANCER_API_TOKEN": "api-token", "PDFDANCER_TOKEN": "legacy-token"},
|
|
72
|
+
):
|
|
73
|
+
result = PDFDancer._resolve_token(None)
|
|
74
|
+
assert result == "api-token"
|
|
75
|
+
|
|
56
76
|
def test_resolve_token_prefers_explicit_over_env(self):
|
|
57
77
|
"""Test that explicit token takes precedence over environment variable."""
|
|
58
78
|
with patch.dict(os.environ, {"PDFDANCER_TOKEN": "env-token"}):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/.github/workflows/daily-tests.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/fingerprint.py
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/image_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/page_builder.py
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/paragraph_builder.py
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/path_builder.py
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/src/pdfdancer/text_line_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_bezier_builder.py
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_context_manager.py
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_form_x_objects.py
RENAMED
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_image_transform.py
RENAMED
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_line_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_path_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_path_comprehensive.py
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_positioning.py
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_rectangle_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_singular_selection.py
RENAMED
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/e2e/test_text_line_edit.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/basic-paths.pdf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/fixtures/mixed-form-types.pdf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_openapi_compliance.py
RENAMED
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_pdf_object_equality.py
RENAMED
|
File without changes
|
|
File without changes
|
{pdfdancer_client_python-0.3.4 → pdfdancer_client_python-0.3.5}/tests/test_standard_fonts.py
RENAMED
|
File without changes
|
|
File without changes
|