tillcast 0.1.1__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.
- tillcast-0.1.1/LICENSE +21 -0
- tillcast-0.1.1/PKG-INFO +232 -0
- tillcast-0.1.1/README.md +197 -0
- tillcast-0.1.1/pyproject.toml +99 -0
- tillcast-0.1.1/src/tillcast/__init__.py +309 -0
- tillcast-0.1.1/src/tillcast/_default_clients.py +30 -0
- tillcast-0.1.1/src/tillcast/client.py +309 -0
- tillcast-0.1.1/src/tillcast/core/__init__.py +127 -0
- tillcast-0.1.1/src/tillcast/core/api_error.py +23 -0
- tillcast-0.1.1/src/tillcast/core/client_wrapper.py +148 -0
- tillcast-0.1.1/src/tillcast/core/datetime_utils.py +70 -0
- tillcast-0.1.1/src/tillcast/core/file.py +67 -0
- tillcast-0.1.1/src/tillcast/core/force_multipart.py +18 -0
- tillcast-0.1.1/src/tillcast/core/http_client.py +975 -0
- tillcast-0.1.1/src/tillcast/core/http_response.py +63 -0
- tillcast-0.1.1/src/tillcast/core/http_sse/__init__.py +42 -0
- tillcast-0.1.1/src/tillcast/core/http_sse/_api.py +455 -0
- tillcast-0.1.1/src/tillcast/core/http_sse/_decoders.py +74 -0
- tillcast-0.1.1/src/tillcast/core/http_sse/_exceptions.py +7 -0
- tillcast-0.1.1/src/tillcast/core/http_sse/_models.py +17 -0
- tillcast-0.1.1/src/tillcast/core/jsonable_encoder.py +133 -0
- tillcast-0.1.1/src/tillcast/core/logging.py +107 -0
- tillcast-0.1.1/src/tillcast/core/parse_error.py +36 -0
- tillcast-0.1.1/src/tillcast/core/pydantic_utilities.py +486 -0
- tillcast-0.1.1/src/tillcast/core/query_encoder.py +58 -0
- tillcast-0.1.1/src/tillcast/core/remove_none_from_dict.py +11 -0
- tillcast-0.1.1/src/tillcast/core/request_options.py +43 -0
- tillcast-0.1.1/src/tillcast/core/serialization.py +347 -0
- tillcast-0.1.1/src/tillcast/customers/__init__.py +4 -0
- tillcast-0.1.1/src/tillcast/customers/client.py +725 -0
- tillcast-0.1.1/src/tillcast/customers/raw_client.py +1507 -0
- tillcast-0.1.1/src/tillcast/environment.py +7 -0
- tillcast-0.1.1/src/tillcast/errors/__init__.py +65 -0
- tillcast-0.1.1/src/tillcast/errors/bad_request_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/conflict_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/content_too_large_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/forbidden_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/internal_server_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/not_found_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/service_unavailable_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/too_many_requests_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/unauthorized_error.py +11 -0
- tillcast-0.1.1/src/tillcast/errors/unprocessable_entity_error.py +11 -0
- tillcast-0.1.1/src/tillcast/jobs/__init__.py +4 -0
- tillcast-0.1.1/src/tillcast/jobs/client.py +563 -0
- tillcast-0.1.1/src/tillcast/jobs/raw_client.py +1100 -0
- tillcast-0.1.1/src/tillcast/locations/__init__.py +4 -0
- tillcast-0.1.1/src/tillcast/locations/client.py +891 -0
- tillcast-0.1.1/src/tillcast/locations/raw_client.py +1825 -0
- tillcast-0.1.1/src/tillcast/organization/__init__.py +4 -0
- tillcast-0.1.1/src/tillcast/organization/client.py +108 -0
- tillcast-0.1.1/src/tillcast/organization/raw_client.py +179 -0
- tillcast-0.1.1/src/tillcast/printers/__init__.py +4 -0
- tillcast-0.1.1/src/tillcast/printers/client.py +1555 -0
- tillcast-0.1.1/src/tillcast/printers/raw_client.py +2900 -0
- tillcast-0.1.1/src/tillcast/py.typed +0 -0
- tillcast-0.1.1/src/tillcast/types/__init__.py +248 -0
- tillcast-0.1.1/src/tillcast/types/api_key_info.py +33 -0
- tillcast-0.1.1/src/tillcast/types/api_key_list.py +26 -0
- tillcast-0.1.1/src/tillcast/types/api_key_object.py +55 -0
- tillcast-0.1.1/src/tillcast/types/api_scope.py +8 -0
- tillcast-0.1.1/src/tillcast/types/change_role_body.py +25 -0
- tillcast-0.1.1/src/tillcast/types/create_api_key.py +38 -0
- tillcast-0.1.1/src/tillcast/types/create_key_body.py +39 -0
- tillcast-0.1.1/src/tillcast/types/create_organization.py +22 -0
- tillcast-0.1.1/src/tillcast/types/create_organization_body.py +23 -0
- tillcast-0.1.1/src/tillcast/types/customer_list.py +34 -0
- tillcast-0.1.1/src/tillcast/types/customer_object.py +49 -0
- tillcast-0.1.1/src/tillcast/types/deleted.py +25 -0
- tillcast-0.1.1/src/tillcast/types/document_type.py +5 -0
- tillcast-0.1.1/src/tillcast/types/document_warning.py +49 -0
- tillcast-0.1.1/src/tillcast/types/domain_setup.py +5 -0
- tillcast-0.1.1/src/tillcast/types/domain_state.py +5 -0
- tillcast-0.1.1/src/tillcast/types/error_object.py +46 -0
- tillcast-0.1.1/src/tillcast/types/error_response.py +24 -0
- tillcast-0.1.1/src/tillcast/types/first_contact_body.py +27 -0
- tillcast-0.1.1/src/tillcast/types/invitation_list.py +22 -0
- tillcast-0.1.1/src/tillcast/types/invitation_object.py +30 -0
- tillcast-0.1.1/src/tillcast/types/invitation_preview.py +40 -0
- tillcast-0.1.1/src/tillcast/types/invite_body.py +25 -0
- tillcast-0.1.1/src/tillcast/types/job_document.py +38 -0
- tillcast-0.1.1/src/tillcast/types/job_list.py +34 -0
- tillcast-0.1.1/src/tillcast/types/job_object.py +97 -0
- tillcast-0.1.1/src/tillcast/types/key_created.py +27 -0
- tillcast-0.1.1/src/tillcast/types/key_creator_object.py +23 -0
- tillcast-0.1.1/src/tillcast/types/key_list.py +22 -0
- tillcast-0.1.1/src/tillcast/types/key_object.py +37 -0
- tillcast-0.1.1/src/tillcast/types/location_list.py +34 -0
- tillcast-0.1.1/src/tillcast/types/location_object.py +48 -0
- tillcast-0.1.1/src/tillcast/types/me_object.py +31 -0
- tillcast-0.1.1/src/tillcast/types/member_list.py +22 -0
- tillcast-0.1.1/src/tillcast/types/member_object.py +24 -0
- tillcast-0.1.1/src/tillcast/types/member_person.py +25 -0
- tillcast-0.1.1/src/tillcast/types/member_removed.py +29 -0
- tillcast-0.1.1/src/tillcast/types/my_organization.py +35 -0
- tillcast-0.1.1/src/tillcast/types/operator_organization_object.py +30 -0
- tillcast-0.1.1/src/tillcast/types/organization_counts.py +25 -0
- tillcast-0.1.1/src/tillcast/types/organization_created.py +28 -0
- tillcast-0.1.1/src/tillcast/types/organization_detail.py +38 -0
- tillcast-0.1.1/src/tillcast/types/organization_list.py +26 -0
- tillcast-0.1.1/src/tillcast/types/organization_object.py +39 -0
- tillcast-0.1.1/src/tillcast/types/print_encoding.py +7 -0
- tillcast-0.1.1/src/tillcast/types/print_options.py +76 -0
- tillcast-0.1.1/src/tillcast/types/printer_deleted.py +27 -0
- tillcast-0.1.1/src/tillcast/types/printer_domain_list.py +26 -0
- tillcast-0.1.1/src/tillcast/types/printer_domain_object.py +42 -0
- tillcast-0.1.1/src/tillcast/types/printer_list.py +34 -0
- tillcast-0.1.1/src/tillcast/types/printer_moved.py +40 -0
- tillcast-0.1.1/src/tillcast/types/printer_object.py +143 -0
- tillcast-0.1.1/src/tillcast/types/printer_profile.py +18 -0
- tillcast-0.1.1/src/tillcast/types/printer_status.py +10 -0
- tillcast-0.1.1/src/tillcast/types/printer_vendor.py +5 -0
- tillcast-0.1.1/src/tillcast/types/printer_with_url.py +34 -0
- tillcast-0.1.1/src/tillcast/types/put_printer_domain.py +36 -0
- tillcast-0.1.1/src/tillcast/types/rename_body.py +25 -0
- tillcast-0.1.1/src/tillcast/types/rename_key_body.py +20 -0
- tillcast-0.1.1/src/tillcast/types/resend_body.py +19 -0
- tillcast-0.1.1/src/tillcast/types/role.py +5 -0
- tillcast-0.1.1/src/tillcast/types/security_event.py +28 -0
- tillcast-0.1.1/src/tillcast/types/security_event_list.py +22 -0
- tillcast-0.1.1/src/tillcast/types/sign_in_method.py +26 -0
- tillcast-0.1.1/src/tillcast/types/step_up_action.py +5 -0
- tillcast-0.1.1/src/tillcast/types/step_up_body.py +29 -0
- tillcast-0.1.1/src/tillcast/types/step_up_granted.py +33 -0
- tillcast-0.1.1/src/tillcast/types/step_up_sent.py +31 -0
- tillcast-0.1.1/src/tillcast/types/test_page.py +5 -0
- tillcast-0.1.1/src/tillcast/types/token_body.py +24 -0
- tillcast-0.1.1/src/tillcast/types/verify_body.py +22 -0
- tillcast-0.1.1/src/tillcast/version.py +3 -0
tillcast-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tillcast
|
|
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.
|
tillcast-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tillcast
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Python client for the Tillcast print API (pre-release).
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: w3center Daniel Miedzik
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: MacOS
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Operating System :: POSIX
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Provides-Extra: aiohttp
|
|
26
|
+
Requires-Dist: aiohttp (>=3.14.1,<4) ; (python_version >= "3.10") and (extra == "aiohttp")
|
|
27
|
+
Requires-Dist: httpx (>=0.21.2)
|
|
28
|
+
Requires-Dist: httpx-aiohttp (>=0.1.8,<0.2.0) ; (python_version >= "3.10") and (extra == "aiohttp")
|
|
29
|
+
Requires-Dist: pydantic (>=1.9.2)
|
|
30
|
+
Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
|
|
31
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
|
32
|
+
Project-URL: Documentation, https://docs.tillcast.com
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Tillcast Python Library
|
|
36
|
+
|
|
37
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Tillcast%2FPython)
|
|
38
|
+
[](https://pypi.python.org/pypi/tillcast)
|
|
39
|
+
|
|
40
|
+
Pre-release (0.x). The Tillcast API is live, but method names can still change before 1.0, so pin the version.
|
|
41
|
+
|
|
42
|
+
## Table of Contents
|
|
43
|
+
|
|
44
|
+
- [Documentation](#documentation)
|
|
45
|
+
- [Installation](#installation)
|
|
46
|
+
- [Reference](#reference)
|
|
47
|
+
- [Usage](#usage)
|
|
48
|
+
- [Environments](#environments)
|
|
49
|
+
- [Async Client](#async-client)
|
|
50
|
+
- [Exception Handling](#exception-handling)
|
|
51
|
+
- [Advanced](#advanced)
|
|
52
|
+
- [Access Raw Response Data](#access-raw-response-data)
|
|
53
|
+
- [Retries](#retries)
|
|
54
|
+
- [Timeouts](#timeouts)
|
|
55
|
+
- [Custom Client](#custom-client)
|
|
56
|
+
- [Contributing](#contributing)
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
API reference documentation is available [here](https://docs.tillcast.com/api-reference).
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
pip install tillcast
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Reference
|
|
69
|
+
|
|
70
|
+
A full reference for this library is available [here](./reference.md).
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
Instantiate and use the client with the following:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from tillcast import Tillcast
|
|
78
|
+
|
|
79
|
+
client = Tillcast(
|
|
80
|
+
token="<token>",
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
client.customers.create(
|
|
84
|
+
idempotency_key="order-4711-bill",
|
|
85
|
+
client_reference_id="acct-1042",
|
|
86
|
+
name="Baltic Hotels Sp. z o.o.",
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Environments
|
|
91
|
+
|
|
92
|
+
This SDK allows you to configure different environments for API requests.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from tillcast import Tillcast
|
|
96
|
+
from tillcast.environment import TillcastEnvironment
|
|
97
|
+
|
|
98
|
+
client = Tillcast(
|
|
99
|
+
environment=TillcastEnvironment.PRODUCTION,
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Async Client
|
|
104
|
+
|
|
105
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import asyncio
|
|
109
|
+
|
|
110
|
+
from tillcast import AsyncTillcast
|
|
111
|
+
|
|
112
|
+
client = AsyncTillcast(
|
|
113
|
+
token="<token>",
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
async def main() -> None:
|
|
118
|
+
await client.customers.create(
|
|
119
|
+
idempotency_key="order-4711-bill",
|
|
120
|
+
client_reference_id="acct-1042",
|
|
121
|
+
name="Baltic Hotels Sp. z o.o.",
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
asyncio.run(main())
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Exception Handling
|
|
129
|
+
|
|
130
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
131
|
+
will be thrown.
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from tillcast.core.api_error import ApiError
|
|
135
|
+
|
|
136
|
+
try:
|
|
137
|
+
client.customers.create(...)
|
|
138
|
+
except ApiError as e:
|
|
139
|
+
print(e.status_code)
|
|
140
|
+
print(e.body)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Advanced
|
|
144
|
+
|
|
145
|
+
### Access Raw Response Data
|
|
146
|
+
|
|
147
|
+
The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
|
|
148
|
+
The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
from tillcast import Tillcast
|
|
152
|
+
|
|
153
|
+
client = Tillcast(...)
|
|
154
|
+
response = client.customers.with_raw_response.create(...)
|
|
155
|
+
print(response.headers) # access the response headers
|
|
156
|
+
print(response.status_code) # access the response status code
|
|
157
|
+
print(response.data) # access the underlying object
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Retries
|
|
161
|
+
|
|
162
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
163
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
164
|
+
retry limit (default: 2).
|
|
165
|
+
|
|
166
|
+
Which status codes are retried depends on the `retryStatusCodes` generator configuration:
|
|
167
|
+
|
|
168
|
+
**`legacy`** (current default): retries on
|
|
169
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
170
|
+
- [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
|
|
171
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
172
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
|
|
173
|
+
|
|
174
|
+
**`recommended`**: retries on
|
|
175
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
176
|
+
- [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
|
|
177
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
178
|
+
- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
|
|
179
|
+
- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
|
|
180
|
+
- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
|
|
181
|
+
|
|
182
|
+
Use the `max_retries` request option to configure this behavior.
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
client.customers.create(..., request_options={
|
|
186
|
+
"max_retries": 1
|
|
187
|
+
})
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Timeouts
|
|
191
|
+
|
|
192
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from tillcast import Tillcast
|
|
196
|
+
|
|
197
|
+
client = Tillcast(..., timeout=20.0)
|
|
198
|
+
|
|
199
|
+
# Override timeout for a specific method
|
|
200
|
+
client.customers.create(..., request_options={
|
|
201
|
+
"timeout": 1
|
|
202
|
+
})
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Custom Client
|
|
206
|
+
|
|
207
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
208
|
+
and transports.
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
import httpx
|
|
212
|
+
from tillcast import Tillcast
|
|
213
|
+
|
|
214
|
+
client = Tillcast(
|
|
215
|
+
...,
|
|
216
|
+
httpx_client=httpx.Client(
|
|
217
|
+
proxy="http://my.test.proxy.example.com",
|
|
218
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
219
|
+
),
|
|
220
|
+
)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Contributing
|
|
224
|
+
|
|
225
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
226
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
227
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
228
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
229
|
+
an issue first to discuss with us!
|
|
230
|
+
|
|
231
|
+
On the other hand, contributions to the README are always very welcome!
|
|
232
|
+
|
tillcast-0.1.1/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Tillcast Python Library
|
|
2
|
+
|
|
3
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Tillcast%2FPython)
|
|
4
|
+
[](https://pypi.python.org/pypi/tillcast)
|
|
5
|
+
|
|
6
|
+
Pre-release (0.x). The Tillcast API is live, but method names can still change before 1.0, so pin the version.
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Documentation](#documentation)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Reference](#reference)
|
|
13
|
+
- [Usage](#usage)
|
|
14
|
+
- [Environments](#environments)
|
|
15
|
+
- [Async Client](#async-client)
|
|
16
|
+
- [Exception Handling](#exception-handling)
|
|
17
|
+
- [Advanced](#advanced)
|
|
18
|
+
- [Access Raw Response Data](#access-raw-response-data)
|
|
19
|
+
- [Retries](#retries)
|
|
20
|
+
- [Timeouts](#timeouts)
|
|
21
|
+
- [Custom Client](#custom-client)
|
|
22
|
+
- [Contributing](#contributing)
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
|
|
26
|
+
API reference documentation is available [here](https://docs.tillcast.com/api-reference).
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install tillcast
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Reference
|
|
35
|
+
|
|
36
|
+
A full reference for this library is available [here](./reference.md).
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
Instantiate and use the client with the following:
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from tillcast import Tillcast
|
|
44
|
+
|
|
45
|
+
client = Tillcast(
|
|
46
|
+
token="<token>",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
client.customers.create(
|
|
50
|
+
idempotency_key="order-4711-bill",
|
|
51
|
+
client_reference_id="acct-1042",
|
|
52
|
+
name="Baltic Hotels Sp. z o.o.",
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Environments
|
|
57
|
+
|
|
58
|
+
This SDK allows you to configure different environments for API requests.
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from tillcast import Tillcast
|
|
62
|
+
from tillcast.environment import TillcastEnvironment
|
|
63
|
+
|
|
64
|
+
client = Tillcast(
|
|
65
|
+
environment=TillcastEnvironment.PRODUCTION,
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Async Client
|
|
70
|
+
|
|
71
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import asyncio
|
|
75
|
+
|
|
76
|
+
from tillcast import AsyncTillcast
|
|
77
|
+
|
|
78
|
+
client = AsyncTillcast(
|
|
79
|
+
token="<token>",
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
async def main() -> None:
|
|
84
|
+
await client.customers.create(
|
|
85
|
+
idempotency_key="order-4711-bill",
|
|
86
|
+
client_reference_id="acct-1042",
|
|
87
|
+
name="Baltic Hotels Sp. z o.o.",
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
asyncio.run(main())
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Exception Handling
|
|
95
|
+
|
|
96
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
97
|
+
will be thrown.
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from tillcast.core.api_error import ApiError
|
|
101
|
+
|
|
102
|
+
try:
|
|
103
|
+
client.customers.create(...)
|
|
104
|
+
except ApiError as e:
|
|
105
|
+
print(e.status_code)
|
|
106
|
+
print(e.body)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Advanced
|
|
110
|
+
|
|
111
|
+
### Access Raw Response Data
|
|
112
|
+
|
|
113
|
+
The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
|
|
114
|
+
The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from tillcast import Tillcast
|
|
118
|
+
|
|
119
|
+
client = Tillcast(...)
|
|
120
|
+
response = client.customers.with_raw_response.create(...)
|
|
121
|
+
print(response.headers) # access the response headers
|
|
122
|
+
print(response.status_code) # access the response status code
|
|
123
|
+
print(response.data) # access the underlying object
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Retries
|
|
127
|
+
|
|
128
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
129
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
130
|
+
retry limit (default: 2).
|
|
131
|
+
|
|
132
|
+
Which status codes are retried depends on the `retryStatusCodes` generator configuration:
|
|
133
|
+
|
|
134
|
+
**`legacy`** (current default): retries on
|
|
135
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
136
|
+
- [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
|
|
137
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
138
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
|
|
139
|
+
|
|
140
|
+
**`recommended`**: retries on
|
|
141
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
142
|
+
- [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
|
|
143
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
144
|
+
- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
|
|
145
|
+
- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
|
|
146
|
+
- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
|
|
147
|
+
|
|
148
|
+
Use the `max_retries` request option to configure this behavior.
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
client.customers.create(..., request_options={
|
|
152
|
+
"max_retries": 1
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Timeouts
|
|
157
|
+
|
|
158
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from tillcast import Tillcast
|
|
162
|
+
|
|
163
|
+
client = Tillcast(..., timeout=20.0)
|
|
164
|
+
|
|
165
|
+
# Override timeout for a specific method
|
|
166
|
+
client.customers.create(..., request_options={
|
|
167
|
+
"timeout": 1
|
|
168
|
+
})
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Custom Client
|
|
172
|
+
|
|
173
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
174
|
+
and transports.
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import httpx
|
|
178
|
+
from tillcast import Tillcast
|
|
179
|
+
|
|
180
|
+
client = Tillcast(
|
|
181
|
+
...,
|
|
182
|
+
httpx_client=httpx.Client(
|
|
183
|
+
proxy="http://my.test.proxy.example.com",
|
|
184
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
185
|
+
),
|
|
186
|
+
)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Contributing
|
|
190
|
+
|
|
191
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
192
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
193
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
194
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
195
|
+
an issue first to discuss with us!
|
|
196
|
+
|
|
197
|
+
On the other hand, contributions to the README are always very welcome!
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tillcast"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
license = "MIT"
|
|
5
|
+
license-files = ["LICENSE"]
|
|
6
|
+
|
|
7
|
+
[tool.poetry]
|
|
8
|
+
name = "tillcast"
|
|
9
|
+
version = "0.1.1"
|
|
10
|
+
description = "Python client for the Tillcast print API (pre-release)."
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
authors = ["w3center Daniel Miedzik"]
|
|
13
|
+
keywords = []
|
|
14
|
+
license = "MIT"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Programming Language :: Python :: 3.15",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
"Operating System :: POSIX",
|
|
27
|
+
"Operating System :: MacOS",
|
|
28
|
+
"Operating System :: POSIX :: Linux",
|
|
29
|
+
"Operating System :: Microsoft :: Windows",
|
|
30
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
31
|
+
"Typing :: Typed"
|
|
32
|
+
]
|
|
33
|
+
packages = [
|
|
34
|
+
{ include = "tillcast", from = "src"}
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[tool.poetry.urls]
|
|
38
|
+
Documentation = "https://docs.tillcast.com"
|
|
39
|
+
|
|
40
|
+
[tool.poetry.dependencies]
|
|
41
|
+
python = "^3.10"
|
|
42
|
+
aiohttp = { version = ">=3.14.1,<4", optional = true, python = ">=3.10"}
|
|
43
|
+
httpx = ">=0.21.2"
|
|
44
|
+
httpx-aiohttp = { version = "^0.1.8", optional = true, python = ">=3.10"}
|
|
45
|
+
pydantic = ">= 1.9.2"
|
|
46
|
+
pydantic-core = ">=2.18.2,<3.0.0"
|
|
47
|
+
typing_extensions = ">= 4.0.0"
|
|
48
|
+
|
|
49
|
+
[tool.poetry.group.dev.dependencies]
|
|
50
|
+
mypy = "==1.13.0"
|
|
51
|
+
pytest = "^9.0.3"
|
|
52
|
+
pytest-asyncio = "^1.0.0"
|
|
53
|
+
pytest-xdist = "^3.6.1"
|
|
54
|
+
python-dateutil = "^2.9.0"
|
|
55
|
+
types-python-dateutil = "^2.9.0.20240316"
|
|
56
|
+
urllib3 = ">=2.6.3,<3.0.0"
|
|
57
|
+
ruff = "==0.11.5"
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
testpaths = [ "tests" ]
|
|
61
|
+
asyncio_mode = "auto"
|
|
62
|
+
norecursedirs = [ "src" ]
|
|
63
|
+
markers = [
|
|
64
|
+
"aiohttp: tests that require httpx_aiohttp to be installed",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[tool.mypy]
|
|
68
|
+
plugins = ["pydantic.mypy"]
|
|
69
|
+
|
|
70
|
+
[tool.ruff]
|
|
71
|
+
line-length = 120
|
|
72
|
+
|
|
73
|
+
[tool.ruff.lint]
|
|
74
|
+
select = [
|
|
75
|
+
"E", # pycodestyle errors
|
|
76
|
+
"F", # pyflakes
|
|
77
|
+
"I", # isort
|
|
78
|
+
]
|
|
79
|
+
ignore = [
|
|
80
|
+
"E402", # Module level import not at top of file
|
|
81
|
+
"E501", # Line too long
|
|
82
|
+
"E711", # Comparison to `None` should be `cond is not None`
|
|
83
|
+
"E712", # Avoid equality comparisons to `True`; use `if ...:` checks
|
|
84
|
+
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
|
|
85
|
+
"E722", # Do not use bare `except`
|
|
86
|
+
"E731", # Do not assign a `lambda` expression, use a `def`
|
|
87
|
+
"F821", # Undefined name
|
|
88
|
+
"F841" # Local variable ... is assigned to but never used
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
[tool.ruff.lint.isort]
|
|
92
|
+
section-order = ["future", "standard-library", "third-party", "first-party"]
|
|
93
|
+
|
|
94
|
+
[build-system]
|
|
95
|
+
requires = ["poetry-core"]
|
|
96
|
+
build-backend = "poetry.core.masonry.api"
|
|
97
|
+
|
|
98
|
+
[tool.poetry.extras]
|
|
99
|
+
aiohttp=["aiohttp", "httpx-aiohttp"]
|