pdfdancer-client-python 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl
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/pdfdancer_v1.py +15 -8
- {pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/METADATA +7 -7
- {pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/RECORD +7 -7
- {pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/WHEEL +0 -0
- {pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/licenses/LICENSE +0 -0
- {pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/licenses/NOTICE +0 -0
- {pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/top_level.txt +0 -0
pdfdancer/pdfdancer_v1.py
CHANGED
|
@@ -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
|
|
{pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/METADATA
RENAMED
|
@@ -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
|
|
|
@@ -6,12 +6,12 @@ pdfdancer/models.py,sha256=HztGaGHOH81qvca5aFhEwQ16xlORVWaT1mk9c0RtS58,55644
|
|
|
6
6
|
pdfdancer/page_builder.py,sha256=ARWLRtlrLGbES-0nbiigTOsRVmodRX0DNK8YIAkA9Ig,3850
|
|
7
7
|
pdfdancer/paragraph_builder.py,sha256=OmhzYazMnq0n0rhrjWcKbo0LQfEC7BZoiLB29ycF630,20504
|
|
8
8
|
pdfdancer/path_builder.py,sha256=safKb_IeHRWlQbyBTIXfcoBfXxUZhuzYvBIob5Tbp-8,23938
|
|
9
|
-
pdfdancer/pdfdancer_v1.py,sha256=
|
|
9
|
+
pdfdancer/pdfdancer_v1.py,sha256=DURns2KrstV14WyzP3Swydzd0DgH6T7U-ULDcYf99Kc,125122
|
|
10
10
|
pdfdancer/text_line_builder.py,sha256=8jYknV4hw0fyzwX0OI_oLvnh5aMmCV3jXaVkmYLu6MQ,10273
|
|
11
11
|
pdfdancer/types.py,sha256=GJpfp7nuIUbnDBmQ3yoyGyQYFuFO1ppHmo7fcfCM0Ks,21554
|
|
12
|
-
pdfdancer_client_python-0.3.
|
|
13
|
-
pdfdancer_client_python-0.3.
|
|
14
|
-
pdfdancer_client_python-0.3.
|
|
15
|
-
pdfdancer_client_python-0.3.
|
|
16
|
-
pdfdancer_client_python-0.3.
|
|
17
|
-
pdfdancer_client_python-0.3.
|
|
12
|
+
pdfdancer_client_python-0.3.5.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
13
|
+
pdfdancer_client_python-0.3.5.dist-info/licenses/NOTICE,sha256=xaC4l-IChAmtViNDie8ZWzUk0O6XRMyzOl0zLmVZ2HE,232
|
|
14
|
+
pdfdancer_client_python-0.3.5.dist-info/METADATA,sha256=1ZSqvW_nOKKOH49Mcb14S-YoMFIQLfKne6BABqh5VIw,27907
|
|
15
|
+
pdfdancer_client_python-0.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
16
|
+
pdfdancer_client_python-0.3.5.dist-info/top_level.txt,sha256=ICwSVRpcCKrdBF9QlaX9Y0e_N3Nk1p7QVxadGOnbxeY,10
|
|
17
|
+
pdfdancer_client_python-0.3.5.dist-info/RECORD,,
|
|
File without changes
|
{pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/licenses/NOTICE
RENAMED
|
File without changes
|
{pdfdancer_client_python-0.3.4.dist-info → pdfdancer_client_python-0.3.5.dist-info}/top_level.txt
RENAMED
|
File without changes
|