printeasy-sdk 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.
- printeasy_sdk-0.1.0/.github/workflows/ci.yml +35 -0
- printeasy_sdk-0.1.0/.github/workflows/release.yml +23 -0
- printeasy_sdk-0.1.0/.gitignore +6 -0
- printeasy_sdk-0.1.0/.python-version +1 -0
- printeasy_sdk-0.1.0/LICENSE +21 -0
- printeasy_sdk-0.1.0/PKG-INFO +92 -0
- printeasy_sdk-0.1.0/README.md +77 -0
- printeasy_sdk-0.1.0/openapi/openapi.json +4448 -0
- printeasy_sdk-0.1.0/openapi-python-client.yml +7 -0
- printeasy_sdk-0.1.0/pyproject.toml +26 -0
- printeasy_sdk-0.1.0/src/printeasy/__init__.py +16 -0
- printeasy_sdk-0.1.0/src/printeasy/_client.py +221 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/__init__.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/__init__.py +1 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/account/__init__.py +1 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/account/get_whoami.py +156 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/computers/__init__.py +1 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/computers/delete_computer.py +192 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/computers/get_computer.py +190 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/computers/list_computers.py +236 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/computers/update_computer.py +216 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/events/__init__.py +1 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/events/list_events.py +277 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/print_jobs/__init__.py +1 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/print_jobs/cancel_print_job.py +199 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/print_jobs/create_print_job.py +267 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/print_jobs/get_print_job.py +190 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/print_jobs/list_print_job_events.py +194 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/print_jobs/list_print_jobs.py +329 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/print_jobs/list_printer_print_jobs.py +259 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/printers/__init__.py +1 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/printers/get_printer.py +190 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/printers/list_computer_printers.py +259 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/printers/list_printers.py +236 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/printers/update_printer.py +220 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/usage/__init__.py +1 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/usage/get_usage.py +156 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/webhooks/__init__.py +1 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/webhooks/create_webhook.py +202 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/webhooks/delete_webhook.py +188 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/webhooks/get_webhook.py +190 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/webhooks/list_webhook_deliveries.py +279 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/webhooks/list_webhooks.py +236 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/webhooks/replay_webhook_delivery.py +199 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/api/webhooks/update_webhook.py +220 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/client.py +282 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/errors.py +16 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/__init__.py +199 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/computer.py +156 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/computer_mode.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/computer_state.py +10 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/error.py +69 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/error_error.py +78 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/event.py +127 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/event_data.py +48 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/event_mode.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/event_type.py +22 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_computer_printers_dir.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_computer_printers_response_200.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_computers_dir.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_computers_response_200.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_events_dir.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_events_response_200.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_print_job_events_response_200.py +76 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_print_jobs_dir.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_print_jobs_response_200.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_print_jobs_state.py +15 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_printer_print_jobs_dir.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_printer_print_jobs_response_200.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_printers_dir.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_printers_response_200.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_webhook_deliveries_dir.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_webhook_deliveries_response_200.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_webhook_deliveries_status.py +11 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_webhooks_dir.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/list_webhooks_response_200.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job.py +275 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_content_type.py +11 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create.py +194 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_authentication.py +86 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_authentication_credentials.py +70 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_authentication_type.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_content_type.py +11 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_options.py +220 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_options_duplex.py +10 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_options_rotate_type_0.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_options_rotate_type_1.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_options_rotate_type_2.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_create_options_rotate_type_3.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_event.py +107 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_event_actor.py +11 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_event_state.py +15 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_mode.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_options.py +212 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_options_duplex.py +10 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_options_rotate_type_0.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_options_rotate_type_1.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_options_rotate_type_2.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_options_rotate_type_3.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/print_job_state.py +15 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer.py +226 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_capabilities.py +247 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_capabilities_papers.py +74 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_capabilities_printrate_type_0.py +70 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_custom_papers_item.py +78 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_default_options.py +220 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_default_options_duplex.py +10 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_default_options_rotate_type_0.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_default_options_rotate_type_1.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_default_options_rotate_type_2.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_default_options_rotate_type_3.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/printer_state.py +10 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_computer_body.py +74 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_printer_body.py +162 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_printer_body_custom_papers_item.py +78 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_printer_body_default_options.py +222 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_printer_body_default_options_duplex.py +10 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_printer_body_default_options_rotate_type_0.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_printer_body_default_options_rotate_type_1.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_printer_body_default_options_rotate_type_2.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/update_printer_body_default_options_rotate_type_3.py +8 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/usage.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/usage_history_item.py +88 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/usage_period.py +88 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_delivery.py +210 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_delivery_event_type.py +22 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_delivery_payload.py +48 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_delivery_status.py +11 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_endpoint.py +169 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_endpoint_create.py +90 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_endpoint_create_events_item.py +22 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_endpoint_events_item.py +22 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_endpoint_mode.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_endpoint_update.py +117 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_endpoint_update_events_item.py +22 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/webhook_endpoint_with_secret.py +178 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/whoami.py +98 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/whoami_mode.py +9 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/models/whoami_organization.py +70 -0
- printeasy_sdk-0.1.0/src/printeasy/_generated/types.py +54 -0
- printeasy_sdk-0.1.0/src/printeasy/_http.py +103 -0
- printeasy_sdk-0.1.0/src/printeasy/_raw.py +15 -0
- printeasy_sdk-0.1.0/src/printeasy/py.typed +0 -0
- printeasy_sdk-0.1.0/src/printeasy/webhooks.py +82 -0
- printeasy_sdk-0.1.0/tests/fixtures/webhook-signature.json +7 -0
- printeasy_sdk-0.1.0/tests/test_client.py +191 -0
- printeasy_sdk-0.1.0/tests/test_generated.py +6 -0
- printeasy_sdk-0.1.0/tests/test_webhooks.py +65 -0
- printeasy_sdk-0.1.0/uv.lock +764 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
on: { push: {}, pull_request: {} }
|
|
3
|
+
permissions: { contents: read }
|
|
4
|
+
env:
|
|
5
|
+
GENERATE: uv run openapi-python-client generate --path openapi/openapi.json --config openapi-python-client.yml --meta none --output-path src/printeasy/_generated --overwrite
|
|
6
|
+
jobs:
|
|
7
|
+
ci:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
11
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
12
|
+
with: { version: "0.10.12" }
|
|
13
|
+
- run: uv sync --locked && $GENERATE
|
|
14
|
+
- run: uv run ruff check && uv run pytest
|
|
15
|
+
# The lowest supported Python, in its own environment.
|
|
16
|
+
- run: uv run --locked --python 3.10 pytest
|
|
17
|
+
env: { UV_PROJECT_ENVIRONMENT: .venv-py310 }
|
|
18
|
+
# Intent to add makes new generated files show up in the diff too.
|
|
19
|
+
- if: github.event_name == 'pull_request'
|
|
20
|
+
run: git add -N src/printeasy/_generated && git diff --exit-code src/printeasy/_generated
|
|
21
|
+
# On main, commit the client regenerated after the API sync bot pushes a new openapi.json.
|
|
22
|
+
regenerate:
|
|
23
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
24
|
+
needs: ci
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
permissions: { contents: write }
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
29
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
30
|
+
with: { version: "0.10.12" }
|
|
31
|
+
- run: uv sync --locked && $GENERATE
|
|
32
|
+
- run: |
|
|
33
|
+
git config user.name "Gaurav" && git config user.email "gaurav@adfinite.com"
|
|
34
|
+
git add src/printeasy/_generated
|
|
35
|
+
git diff --cached --quiet || { git commit -m "Regenerate client from openapi.json" -m "Co-Authored-By: Gaurav <gaurav@adfinite.com>" && git push; }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
on: { push: { tags: ["v*"] } }
|
|
3
|
+
permissions: { contents: read }
|
|
4
|
+
jobs:
|
|
5
|
+
build:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
steps:
|
|
8
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
9
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
10
|
+
with: { version: "0.10.12" }
|
|
11
|
+
# The tag must match the version in pyproject.toml.
|
|
12
|
+
- run: test "v$(uv version --short)" = "$GITHUB_REF_NAME" && uv sync --locked && uv run pytest && uv build
|
|
13
|
+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
14
|
+
with: { name: dist, path: dist/ }
|
|
15
|
+
publish:
|
|
16
|
+
needs: build
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
environment: pypi
|
|
19
|
+
permissions: { id-token: write }
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
|
22
|
+
with: { name: dist, path: dist/ }
|
|
23
|
+
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Adfinite
|
|
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,92 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: printeasy-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the PrintEasy cloud printing API
|
|
5
|
+
Project-URL: Repository, https://github.com/GauravBR/printeasy-sdk-python
|
|
6
|
+
Project-URL: Documentation, https://docs.printeasy.adfinite.com/sdks/python
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: attrs>=23.1
|
|
11
|
+
Requires-Dist: httpx<1,>=0.27
|
|
12
|
+
Requires-Dist: python-dateutil>=2.8
|
|
13
|
+
Requires-Dist: typing-extensions>=4.7
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# printeasy-sdk-python
|
|
17
|
+
|
|
18
|
+
Python client for the [PrintEasy](https://printeasy.adfinite.com) cloud printing API.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
pip install printeasy-sdk
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The distribution is named `printeasy-sdk`; the import package is `printeasy`. Python 3.10 or newer.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from printeasy import PrintEasy
|
|
32
|
+
|
|
33
|
+
pe = PrintEasy("pe_test_...") # or set PRINTEASY_API_KEY
|
|
34
|
+
|
|
35
|
+
job = pe.print_jobs.create_and_wait(
|
|
36
|
+
{
|
|
37
|
+
"printerId": "0192f1a0-7c00-7000-8000-0000000000bb",
|
|
38
|
+
"title": "Invoice 1042",
|
|
39
|
+
"contentType": "pdf_uri",
|
|
40
|
+
"content": "https://example.com/invoice-1042.pdf",
|
|
41
|
+
},
|
|
42
|
+
timeout_s=60,
|
|
43
|
+
)
|
|
44
|
+
print(job["state"])
|
|
45
|
+
|
|
46
|
+
for printer in pe.printers.iterate(limit=100):
|
|
47
|
+
print(printer["id"], printer["name"])
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Resources: `computers`, `printers`, `print_jobs` and `webhooks` have `list`, `iterate` and `get`; `events` has `list` and `iterate`. `print_jobs.create` always sends an Idempotency-Key (a random one unless you pass `idempotency_key=`), so retries never print twice. The client retries 429 responses, and 5xx or network errors for replay safe requests, up to `max_retries` (default 3). Errors raise `PrintEasyError` with `status`, `code` and `request_id`.
|
|
51
|
+
|
|
52
|
+
`pe.raw` is the generated, fully typed client (`printeasy._generated`) sharing the same retrying connection:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from printeasy._generated.api.account import get_whoami
|
|
56
|
+
|
|
57
|
+
who = get_whoami.sync(client=pe.raw)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Caveats: only the sync functions on `pe.raw` itself retry. `pe.raw.with_headers(...)` (and `with_cookies`, `with_timeout`) adds the change to the shared client but returns a copy that builds its own httpx client without retries, and the `asyncio` variants use a separate async client that does not retry.
|
|
61
|
+
|
|
62
|
+
## Webhooks
|
|
63
|
+
|
|
64
|
+
Verify each request with the endpoint's signing secret before trusting it. Pass the raw body, not parsed JSON:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from printeasy import WebhookVerificationError, webhooks
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
webhooks.verify(request.body, request.headers, "whsec_...")
|
|
71
|
+
except WebhookVerificationError:
|
|
72
|
+
return 400
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
uv sync
|
|
79
|
+
uv run openapi-python-client generate --path openapi/openapi.json --config openapi-python-client.yml --meta none --output-path src/printeasy/_generated --overwrite
|
|
80
|
+
uv run ruff check && uv run pytest
|
|
81
|
+
uv build
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`openapi/openapi.json` is synced from printeasy-api, and `src/printeasy/_generated` is generated from it; do not edit either by hand. CI regenerates the client on every push and fails a pull request whose generated code is stale.
|
|
85
|
+
|
|
86
|
+
## Releasing
|
|
87
|
+
|
|
88
|
+
Set `version` in `pyproject.toml`, merge, then push a matching tag (`git tag v0.1.0 && git push origin v0.1.0`). The `release` workflow checks that the tag matches the version, runs the tests, builds and publishes to PyPI through trusted publishing (GitHub environment `pypi`).
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# printeasy-sdk-python
|
|
2
|
+
|
|
3
|
+
Python client for the [PrintEasy](https://printeasy.adfinite.com) cloud printing API.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pip install printeasy-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The distribution is named `printeasy-sdk`; the import package is `printeasy`. Python 3.10 or newer.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from printeasy import PrintEasy
|
|
17
|
+
|
|
18
|
+
pe = PrintEasy("pe_test_...") # or set PRINTEASY_API_KEY
|
|
19
|
+
|
|
20
|
+
job = pe.print_jobs.create_and_wait(
|
|
21
|
+
{
|
|
22
|
+
"printerId": "0192f1a0-7c00-7000-8000-0000000000bb",
|
|
23
|
+
"title": "Invoice 1042",
|
|
24
|
+
"contentType": "pdf_uri",
|
|
25
|
+
"content": "https://example.com/invoice-1042.pdf",
|
|
26
|
+
},
|
|
27
|
+
timeout_s=60,
|
|
28
|
+
)
|
|
29
|
+
print(job["state"])
|
|
30
|
+
|
|
31
|
+
for printer in pe.printers.iterate(limit=100):
|
|
32
|
+
print(printer["id"], printer["name"])
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Resources: `computers`, `printers`, `print_jobs` and `webhooks` have `list`, `iterate` and `get`; `events` has `list` and `iterate`. `print_jobs.create` always sends an Idempotency-Key (a random one unless you pass `idempotency_key=`), so retries never print twice. The client retries 429 responses, and 5xx or network errors for replay safe requests, up to `max_retries` (default 3). Errors raise `PrintEasyError` with `status`, `code` and `request_id`.
|
|
36
|
+
|
|
37
|
+
`pe.raw` is the generated, fully typed client (`printeasy._generated`) sharing the same retrying connection:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from printeasy._generated.api.account import get_whoami
|
|
41
|
+
|
|
42
|
+
who = get_whoami.sync(client=pe.raw)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Caveats: only the sync functions on `pe.raw` itself retry. `pe.raw.with_headers(...)` (and `with_cookies`, `with_timeout`) adds the change to the shared client but returns a copy that builds its own httpx client without retries, and the `asyncio` variants use a separate async client that does not retry.
|
|
46
|
+
|
|
47
|
+
## Webhooks
|
|
48
|
+
|
|
49
|
+
Verify each request with the endpoint's signing secret before trusting it. Pass the raw body, not parsed JSON:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from printeasy import WebhookVerificationError, webhooks
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
webhooks.verify(request.body, request.headers, "whsec_...")
|
|
56
|
+
except WebhookVerificationError:
|
|
57
|
+
return 400
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
uv sync
|
|
64
|
+
uv run openapi-python-client generate --path openapi/openapi.json --config openapi-python-client.yml --meta none --output-path src/printeasy/_generated --overwrite
|
|
65
|
+
uv run ruff check && uv run pytest
|
|
66
|
+
uv build
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`openapi/openapi.json` is synced from printeasy-api, and `src/printeasy/_generated` is generated from it; do not edit either by hand. CI regenerates the client on every push and fails a pull request whose generated code is stale.
|
|
70
|
+
|
|
71
|
+
## Releasing
|
|
72
|
+
|
|
73
|
+
Set `version` in `pyproject.toml`, merge, then push a matching tag (`git tag v0.1.0 && git push origin v0.1.0`). The `release` workflow checks that the tag matches the version, runs the tests, builds and publishes to PyPI through trusted publishing (GitHub environment `pypi`).
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT
|