bookalimo 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.
- bookalimo-0.1.1/LICENSE +0 -0
- bookalimo-0.1.1/PKG-INFO +331 -0
- bookalimo-0.1.1/README.md +273 -0
- bookalimo-0.1.1/pyproject.toml +160 -0
- bookalimo-0.1.1/setup.cfg +4 -0
- bookalimo-0.1.1/src/bookalimo/__init__.py +28 -0
- bookalimo-0.1.1/src/bookalimo/_client.py +350 -0
- bookalimo-0.1.1/src/bookalimo/models.py +532 -0
- bookalimo-0.1.1/src/bookalimo/py.typed +1 -0
- bookalimo-0.1.1/src/bookalimo/wrapper.py +396 -0
- bookalimo-0.1.1/src/bookalimo.egg-info/PKG-INFO +331 -0
- bookalimo-0.1.1/src/bookalimo.egg-info/SOURCES.txt +16 -0
- bookalimo-0.1.1/src/bookalimo.egg-info/dependency_links.txt +1 -0
- bookalimo-0.1.1/src/bookalimo.egg-info/requires.txt +32 -0
- bookalimo-0.1.1/src/bookalimo.egg-info/top_level.txt +1 -0
- bookalimo-0.1.1/tests/test_client.py +69 -0
- bookalimo-0.1.1/tests/test_models.py +50 -0
- bookalimo-0.1.1/tests/test_wrapper.py +69 -0
bookalimo-0.1.1/LICENSE
ADDED
File without changes
|
bookalimo-0.1.1/PKG-INFO
ADDED
@@ -0,0 +1,331 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: bookalimo
|
3
|
+
Version: 0.1.1
|
4
|
+
Summary: Python wrapper for the Book-A-Limo API
|
5
|
+
Author-email: Jonathan Oren <jonathan@bookalimo.com>
|
6
|
+
Maintainer-email: Jonathan Oren <jonathan@bookalimo.com>
|
7
|
+
License: MIT
|
8
|
+
Project-URL: Homepage, https://github.com/yourusername/bookalimo-python
|
9
|
+
Project-URL: Documentation, https://yourusername.github.io/bookalimo-python
|
10
|
+
Project-URL: Repository, https://github.com/yourusername/bookalimo-python
|
11
|
+
Project-URL: Issues, https://github.com/yourusername/bookalimo-python/issues
|
12
|
+
Project-URL: Changelog, https://github.com/yourusername/bookalimo-python/blob/main/CHANGELOG.md
|
13
|
+
Keywords: bookalimo,api,transportation,booking
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
15
|
+
Classifier: Intended Audience :: Developers
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
17
|
+
Classifier: Operating System :: OS Independent
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
24
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
25
|
+
Requires-Python: >=3.9
|
26
|
+
Description-Content-Type: text/markdown
|
27
|
+
License-File: LICENSE
|
28
|
+
Requires-Dist: httpx>=0.25.0
|
29
|
+
Requires-Dist: pydantic>=2.0.0
|
30
|
+
Requires-Dist: pycountry>=22.0.0
|
31
|
+
Requires-Dist: us>=3.0.0
|
32
|
+
Requires-Dist: airportsdata>=20230101
|
33
|
+
Provides-Extra: dev
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
35
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
36
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
37
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
38
|
+
Requires-Dist: httpx[mock]>=0.25.0; extra == "dev"
|
39
|
+
Requires-Dist: respx>=0.20.0; extra == "dev"
|
40
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
41
|
+
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
42
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
43
|
+
Requires-Dist: mkdocs>=1.5.0; extra == "dev"
|
44
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "dev"
|
45
|
+
Requires-Dist: mkdocstrings[python]>=0.23.0; extra == "dev"
|
46
|
+
Provides-Extra: docs
|
47
|
+
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
|
48
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
49
|
+
Requires-Dist: mkdocstrings[python]>=0.23.0; extra == "docs"
|
50
|
+
Provides-Extra: test
|
51
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
52
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
|
53
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
54
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
55
|
+
Requires-Dist: httpx[mock]>=0.25.0; extra == "test"
|
56
|
+
Requires-Dist: respx>=0.20.0; extra == "test"
|
57
|
+
Dynamic: license-file
|
58
|
+
|
59
|
+
# Book-A-Limo Python SDK
|
60
|
+
|
61
|
+
[](https://badge.fury.io/py/bookalimo)
|
62
|
+
[](https://pypi.org/project/bookalimo/)
|
63
|
+
[](https://opensource.org/licenses/MIT)
|
64
|
+
[](https://github.com/astral-sh/ruff)
|
65
|
+
|
66
|
+
A modern, async Python wrapper for the Book-A-Limo API with full type support.
|
67
|
+
|
68
|
+
## Features
|
69
|
+
|
70
|
+
* **Async/await** (built on `httpx`)
|
71
|
+
* **Typed Pydantic models** for requests & responses
|
72
|
+
* **Input validation**
|
73
|
+
* **Clean, minimal interface** for each API operation
|
74
|
+
* **Custom exceptions & error handling**
|
75
|
+
* **Tests and examples**
|
76
|
+
|
77
|
+
## Requirements
|
78
|
+
|
79
|
+
* Python **3.9+** (`pyproject.toml` sets `requires-python = ">=3.9"`)
|
80
|
+
* An async event loop (examples use `asyncio`)
|
81
|
+
* Time strings use **`MM/dd/yyyy hh:mm tt`** (e.g., `09/05/2025 12:44 AM`)
|
82
|
+
|
83
|
+
## Installation
|
84
|
+
|
85
|
+
```bash
|
86
|
+
pip install bookalimo
|
87
|
+
```
|
88
|
+
|
89
|
+
## Quick Start
|
90
|
+
|
91
|
+
```python
|
92
|
+
import asyncio
|
93
|
+
from httpx import AsyncClient
|
94
|
+
|
95
|
+
from bookalimo import (
|
96
|
+
BookALimo,
|
97
|
+
create_credentials,
|
98
|
+
create_airport_location,
|
99
|
+
create_address_location,
|
100
|
+
)
|
101
|
+
from bookalimo.models import RateType # enums/models come from bookalimo.models
|
102
|
+
|
103
|
+
async def main():
|
104
|
+
# For Travel Agents (customers: pass is_customer=True)
|
105
|
+
credentials = create_credentials("TA10007", "your_password")
|
106
|
+
|
107
|
+
async with AsyncClient() as http_client:
|
108
|
+
async with BookALimo(credentials, http_client=http_client) as client:
|
109
|
+
# Build locations
|
110
|
+
pickup = create_airport_location("JFK", "New York")
|
111
|
+
dropoff = create_address_location("53 East 34th Street, Manhattan")
|
112
|
+
|
113
|
+
prices = await client.get_prices(
|
114
|
+
rate_type=RateType.P2P,
|
115
|
+
date_time="09/05/2025 12:44 AM",
|
116
|
+
pickup=pickup,
|
117
|
+
dropoff=dropoff,
|
118
|
+
passengers=2,
|
119
|
+
luggage=3,
|
120
|
+
)
|
121
|
+
|
122
|
+
print(f"Available cars: {len(prices.prices)}")
|
123
|
+
for price in prices.prices:
|
124
|
+
print(f"- {price.car_description}: ${price.price}")
|
125
|
+
|
126
|
+
if __name__ == "__main__":
|
127
|
+
asyncio.run(main())
|
128
|
+
```
|
129
|
+
|
130
|
+
### Using the Sandbox
|
131
|
+
|
132
|
+
```python
|
133
|
+
async with AsyncClient() as http_client:
|
134
|
+
async with BookALimo(
|
135
|
+
credentials, http_client=http_client, sandbox=True
|
136
|
+
) as client:
|
137
|
+
...
|
138
|
+
```
|
139
|
+
|
140
|
+
## Authentication
|
141
|
+
|
142
|
+
```python
|
143
|
+
from bookalimo import create_credentials
|
144
|
+
|
145
|
+
# Travel Agents
|
146
|
+
ta_creds = create_credentials("TA10007", "password", is_customer=False)
|
147
|
+
|
148
|
+
# Customers
|
149
|
+
cust_creds = create_credentials("customer@email.com", "password", is_customer=True)
|
150
|
+
```
|
151
|
+
|
152
|
+
## Core Operations
|
153
|
+
|
154
|
+
```python
|
155
|
+
# List Reservations
|
156
|
+
reservations = await client.list_reservations(is_archive=False)
|
157
|
+
|
158
|
+
# Get Reservation Details
|
159
|
+
details = await client.get_reservation("5452773")
|
160
|
+
```
|
161
|
+
|
162
|
+
### Get Pricing
|
163
|
+
|
164
|
+
```python
|
165
|
+
from bookalimo.models import RateType
|
166
|
+
|
167
|
+
prices = await client.get_prices(
|
168
|
+
rate_type=RateType.P2P,
|
169
|
+
date_time="09/05/2025 12:44 AM",
|
170
|
+
pickup=pickup, # Location
|
171
|
+
dropoff=dropoff, # Location
|
172
|
+
passengers=2,
|
173
|
+
luggage=3,
|
174
|
+
# Optional kwargs:
|
175
|
+
# hours=2, stops=[...], account=..., passenger=..., rewards=[...],
|
176
|
+
# car_class_code="SD", pets=0, car_seats=0, boosters=0, infants=0,
|
177
|
+
# customer_comment="..."
|
178
|
+
)
|
179
|
+
```
|
180
|
+
|
181
|
+
### Book a Reservation
|
182
|
+
|
183
|
+
```python
|
184
|
+
from bookalimo import create_credit_card, create_passenger
|
185
|
+
from bookalimo.models import CardHolderType
|
186
|
+
|
187
|
+
# Optionally set details first (select car class, add passenger, etc.)
|
188
|
+
details = await client.set_details(
|
189
|
+
token=prices.token,
|
190
|
+
car_class_code="SD",
|
191
|
+
passenger=create_passenger("John", "Smith", "+19173334455"),
|
192
|
+
)
|
193
|
+
|
194
|
+
# Book with credit card
|
195
|
+
card = create_credit_card(
|
196
|
+
number="4111 1111 1111 1111", # test PAN
|
197
|
+
card_holder="John Smith",
|
198
|
+
holder_type=CardHolderType.PERSONAL,
|
199
|
+
expiration="01/28",
|
200
|
+
cvv="123",
|
201
|
+
zip_code="10016",
|
202
|
+
)
|
203
|
+
|
204
|
+
booking = await client.book(token=prices.token, credit_card=card)
|
205
|
+
print(f"Booked! Confirmation: {booking.reservation_id}")
|
206
|
+
|
207
|
+
# Or charge account
|
208
|
+
booking = await client.book(token=prices.token, method="charge")
|
209
|
+
```
|
210
|
+
|
211
|
+
## Location Builders
|
212
|
+
|
213
|
+
### Airport Locations
|
214
|
+
|
215
|
+
```python
|
216
|
+
from bookalimo import create_airport_location
|
217
|
+
|
218
|
+
pickup = create_airport_location(
|
219
|
+
iata_code="JFK",
|
220
|
+
city_name="New York",
|
221
|
+
airline_code="UA",
|
222
|
+
flight_number="UA1234",
|
223
|
+
terminal="7",
|
224
|
+
)
|
225
|
+
```
|
226
|
+
|
227
|
+
### Address Locations
|
228
|
+
|
229
|
+
```python
|
230
|
+
from bookalimo import create_address_location
|
231
|
+
|
232
|
+
dropoff = create_address_location(
|
233
|
+
address="53 East 34th Street, Manhattan",
|
234
|
+
zip_code="10016",
|
235
|
+
)
|
236
|
+
```
|
237
|
+
|
238
|
+
### Stops
|
239
|
+
|
240
|
+
```python
|
241
|
+
from bookalimo import create_stop
|
242
|
+
|
243
|
+
stops = [
|
244
|
+
create_stop("Brooklyn Bridge", is_en_route=False),
|
245
|
+
create_stop("Empire State Building", is_en_route=True),
|
246
|
+
]
|
247
|
+
```
|
248
|
+
|
249
|
+
## Advanced
|
250
|
+
|
251
|
+
### Using Account Info (Travel Agents)
|
252
|
+
|
253
|
+
```python
|
254
|
+
from bookalimo.models import Account # models (not re-exported at top-level)
|
255
|
+
|
256
|
+
account = Account(
|
257
|
+
id="TA10007",
|
258
|
+
department="Sales",
|
259
|
+
booker_first_name="Jane",
|
260
|
+
booker_last_name="Agent",
|
261
|
+
booker_email="jane@agency.com",
|
262
|
+
booker_phone="+19173334455",
|
263
|
+
)
|
264
|
+
|
265
|
+
prices = await client.get_prices(
|
266
|
+
# ... required args
|
267
|
+
account=account,
|
268
|
+
)
|
269
|
+
```
|
270
|
+
|
271
|
+
### Edit / Cancel a Reservation
|
272
|
+
|
273
|
+
```python
|
274
|
+
# Edit (e.g., add note or change passengers). Omitting fields leaves them unchanged.
|
275
|
+
edit_result = await client.edit_reservation(
|
276
|
+
confirmation="5452773",
|
277
|
+
is_cancel_request=False,
|
278
|
+
passengers=3,
|
279
|
+
other="Gate pickup",
|
280
|
+
)
|
281
|
+
|
282
|
+
# Cancel
|
283
|
+
cancel_result = await client.edit_reservation(
|
284
|
+
confirmation="5452773",
|
285
|
+
is_cancel_request=True,
|
286
|
+
)
|
287
|
+
```
|
288
|
+
|
289
|
+
## Error Handling
|
290
|
+
|
291
|
+
```python
|
292
|
+
from bookalimo._client import BookALimoError # currently defined here
|
293
|
+
|
294
|
+
try:
|
295
|
+
reservations = await client.list_reservations()
|
296
|
+
except BookALimoError as e:
|
297
|
+
print(f"API Error: {e}")
|
298
|
+
print(f"Status Code: {e.status_code}")
|
299
|
+
print(f"Response Data: {e.response_data}")
|
300
|
+
```
|
301
|
+
|
302
|
+
## Development
|
303
|
+
|
304
|
+
```bash
|
305
|
+
# Clone & setup
|
306
|
+
git clone https://github.com/yourusername/bookalimo-python.git
|
307
|
+
cd bookalimo-python
|
308
|
+
pip install -e ".[dev]"
|
309
|
+
pre-commit install
|
310
|
+
|
311
|
+
# Run tests
|
312
|
+
pytest
|
313
|
+
pytest --cov=bookalimo --cov-report=html
|
314
|
+
|
315
|
+
# Docs (MkDocs)
|
316
|
+
mkdocs serve
|
317
|
+
```
|
318
|
+
|
319
|
+
## Security Notes
|
320
|
+
|
321
|
+
* Never log raw passwords or credit card numbers.
|
322
|
+
* Store credentials securely (e.g., environment variables, secrets managers).
|
323
|
+
* Use sandbox for testing.
|
324
|
+
|
325
|
+
## License
|
326
|
+
|
327
|
+
This project is licensed under the MIT License — see [`LICENSE`](LICENSE).
|
328
|
+
|
329
|
+
## Changelog
|
330
|
+
|
331
|
+
See [`CHANGELOG.md`](CHANGELOG.md) for release history.
|
@@ -0,0 +1,273 @@
|
|
1
|
+
# Book-A-Limo Python SDK
|
2
|
+
|
3
|
+
[](https://badge.fury.io/py/bookalimo)
|
4
|
+
[](https://pypi.org/project/bookalimo/)
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
6
|
+
[](https://github.com/astral-sh/ruff)
|
7
|
+
|
8
|
+
A modern, async Python wrapper for the Book-A-Limo API with full type support.
|
9
|
+
|
10
|
+
## Features
|
11
|
+
|
12
|
+
* **Async/await** (built on `httpx`)
|
13
|
+
* **Typed Pydantic models** for requests & responses
|
14
|
+
* **Input validation**
|
15
|
+
* **Clean, minimal interface** for each API operation
|
16
|
+
* **Custom exceptions & error handling**
|
17
|
+
* **Tests and examples**
|
18
|
+
|
19
|
+
## Requirements
|
20
|
+
|
21
|
+
* Python **3.9+** (`pyproject.toml` sets `requires-python = ">=3.9"`)
|
22
|
+
* An async event loop (examples use `asyncio`)
|
23
|
+
* Time strings use **`MM/dd/yyyy hh:mm tt`** (e.g., `09/05/2025 12:44 AM`)
|
24
|
+
|
25
|
+
## Installation
|
26
|
+
|
27
|
+
```bash
|
28
|
+
pip install bookalimo
|
29
|
+
```
|
30
|
+
|
31
|
+
## Quick Start
|
32
|
+
|
33
|
+
```python
|
34
|
+
import asyncio
|
35
|
+
from httpx import AsyncClient
|
36
|
+
|
37
|
+
from bookalimo import (
|
38
|
+
BookALimo,
|
39
|
+
create_credentials,
|
40
|
+
create_airport_location,
|
41
|
+
create_address_location,
|
42
|
+
)
|
43
|
+
from bookalimo.models import RateType # enums/models come from bookalimo.models
|
44
|
+
|
45
|
+
async def main():
|
46
|
+
# For Travel Agents (customers: pass is_customer=True)
|
47
|
+
credentials = create_credentials("TA10007", "your_password")
|
48
|
+
|
49
|
+
async with AsyncClient() as http_client:
|
50
|
+
async with BookALimo(credentials, http_client=http_client) as client:
|
51
|
+
# Build locations
|
52
|
+
pickup = create_airport_location("JFK", "New York")
|
53
|
+
dropoff = create_address_location("53 East 34th Street, Manhattan")
|
54
|
+
|
55
|
+
prices = await client.get_prices(
|
56
|
+
rate_type=RateType.P2P,
|
57
|
+
date_time="09/05/2025 12:44 AM",
|
58
|
+
pickup=pickup,
|
59
|
+
dropoff=dropoff,
|
60
|
+
passengers=2,
|
61
|
+
luggage=3,
|
62
|
+
)
|
63
|
+
|
64
|
+
print(f"Available cars: {len(prices.prices)}")
|
65
|
+
for price in prices.prices:
|
66
|
+
print(f"- {price.car_description}: ${price.price}")
|
67
|
+
|
68
|
+
if __name__ == "__main__":
|
69
|
+
asyncio.run(main())
|
70
|
+
```
|
71
|
+
|
72
|
+
### Using the Sandbox
|
73
|
+
|
74
|
+
```python
|
75
|
+
async with AsyncClient() as http_client:
|
76
|
+
async with BookALimo(
|
77
|
+
credentials, http_client=http_client, sandbox=True
|
78
|
+
) as client:
|
79
|
+
...
|
80
|
+
```
|
81
|
+
|
82
|
+
## Authentication
|
83
|
+
|
84
|
+
```python
|
85
|
+
from bookalimo import create_credentials
|
86
|
+
|
87
|
+
# Travel Agents
|
88
|
+
ta_creds = create_credentials("TA10007", "password", is_customer=False)
|
89
|
+
|
90
|
+
# Customers
|
91
|
+
cust_creds = create_credentials("customer@email.com", "password", is_customer=True)
|
92
|
+
```
|
93
|
+
|
94
|
+
## Core Operations
|
95
|
+
|
96
|
+
```python
|
97
|
+
# List Reservations
|
98
|
+
reservations = await client.list_reservations(is_archive=False)
|
99
|
+
|
100
|
+
# Get Reservation Details
|
101
|
+
details = await client.get_reservation("5452773")
|
102
|
+
```
|
103
|
+
|
104
|
+
### Get Pricing
|
105
|
+
|
106
|
+
```python
|
107
|
+
from bookalimo.models import RateType
|
108
|
+
|
109
|
+
prices = await client.get_prices(
|
110
|
+
rate_type=RateType.P2P,
|
111
|
+
date_time="09/05/2025 12:44 AM",
|
112
|
+
pickup=pickup, # Location
|
113
|
+
dropoff=dropoff, # Location
|
114
|
+
passengers=2,
|
115
|
+
luggage=3,
|
116
|
+
# Optional kwargs:
|
117
|
+
# hours=2, stops=[...], account=..., passenger=..., rewards=[...],
|
118
|
+
# car_class_code="SD", pets=0, car_seats=0, boosters=0, infants=0,
|
119
|
+
# customer_comment="..."
|
120
|
+
)
|
121
|
+
```
|
122
|
+
|
123
|
+
### Book a Reservation
|
124
|
+
|
125
|
+
```python
|
126
|
+
from bookalimo import create_credit_card, create_passenger
|
127
|
+
from bookalimo.models import CardHolderType
|
128
|
+
|
129
|
+
# Optionally set details first (select car class, add passenger, etc.)
|
130
|
+
details = await client.set_details(
|
131
|
+
token=prices.token,
|
132
|
+
car_class_code="SD",
|
133
|
+
passenger=create_passenger("John", "Smith", "+19173334455"),
|
134
|
+
)
|
135
|
+
|
136
|
+
# Book with credit card
|
137
|
+
card = create_credit_card(
|
138
|
+
number="4111 1111 1111 1111", # test PAN
|
139
|
+
card_holder="John Smith",
|
140
|
+
holder_type=CardHolderType.PERSONAL,
|
141
|
+
expiration="01/28",
|
142
|
+
cvv="123",
|
143
|
+
zip_code="10016",
|
144
|
+
)
|
145
|
+
|
146
|
+
booking = await client.book(token=prices.token, credit_card=card)
|
147
|
+
print(f"Booked! Confirmation: {booking.reservation_id}")
|
148
|
+
|
149
|
+
# Or charge account
|
150
|
+
booking = await client.book(token=prices.token, method="charge")
|
151
|
+
```
|
152
|
+
|
153
|
+
## Location Builders
|
154
|
+
|
155
|
+
### Airport Locations
|
156
|
+
|
157
|
+
```python
|
158
|
+
from bookalimo import create_airport_location
|
159
|
+
|
160
|
+
pickup = create_airport_location(
|
161
|
+
iata_code="JFK",
|
162
|
+
city_name="New York",
|
163
|
+
airline_code="UA",
|
164
|
+
flight_number="UA1234",
|
165
|
+
terminal="7",
|
166
|
+
)
|
167
|
+
```
|
168
|
+
|
169
|
+
### Address Locations
|
170
|
+
|
171
|
+
```python
|
172
|
+
from bookalimo import create_address_location
|
173
|
+
|
174
|
+
dropoff = create_address_location(
|
175
|
+
address="53 East 34th Street, Manhattan",
|
176
|
+
zip_code="10016",
|
177
|
+
)
|
178
|
+
```
|
179
|
+
|
180
|
+
### Stops
|
181
|
+
|
182
|
+
```python
|
183
|
+
from bookalimo import create_stop
|
184
|
+
|
185
|
+
stops = [
|
186
|
+
create_stop("Brooklyn Bridge", is_en_route=False),
|
187
|
+
create_stop("Empire State Building", is_en_route=True),
|
188
|
+
]
|
189
|
+
```
|
190
|
+
|
191
|
+
## Advanced
|
192
|
+
|
193
|
+
### Using Account Info (Travel Agents)
|
194
|
+
|
195
|
+
```python
|
196
|
+
from bookalimo.models import Account # models (not re-exported at top-level)
|
197
|
+
|
198
|
+
account = Account(
|
199
|
+
id="TA10007",
|
200
|
+
department="Sales",
|
201
|
+
booker_first_name="Jane",
|
202
|
+
booker_last_name="Agent",
|
203
|
+
booker_email="jane@agency.com",
|
204
|
+
booker_phone="+19173334455",
|
205
|
+
)
|
206
|
+
|
207
|
+
prices = await client.get_prices(
|
208
|
+
# ... required args
|
209
|
+
account=account,
|
210
|
+
)
|
211
|
+
```
|
212
|
+
|
213
|
+
### Edit / Cancel a Reservation
|
214
|
+
|
215
|
+
```python
|
216
|
+
# Edit (e.g., add note or change passengers). Omitting fields leaves them unchanged.
|
217
|
+
edit_result = await client.edit_reservation(
|
218
|
+
confirmation="5452773",
|
219
|
+
is_cancel_request=False,
|
220
|
+
passengers=3,
|
221
|
+
other="Gate pickup",
|
222
|
+
)
|
223
|
+
|
224
|
+
# Cancel
|
225
|
+
cancel_result = await client.edit_reservation(
|
226
|
+
confirmation="5452773",
|
227
|
+
is_cancel_request=True,
|
228
|
+
)
|
229
|
+
```
|
230
|
+
|
231
|
+
## Error Handling
|
232
|
+
|
233
|
+
```python
|
234
|
+
from bookalimo._client import BookALimoError # currently defined here
|
235
|
+
|
236
|
+
try:
|
237
|
+
reservations = await client.list_reservations()
|
238
|
+
except BookALimoError as e:
|
239
|
+
print(f"API Error: {e}")
|
240
|
+
print(f"Status Code: {e.status_code}")
|
241
|
+
print(f"Response Data: {e.response_data}")
|
242
|
+
```
|
243
|
+
|
244
|
+
## Development
|
245
|
+
|
246
|
+
```bash
|
247
|
+
# Clone & setup
|
248
|
+
git clone https://github.com/yourusername/bookalimo-python.git
|
249
|
+
cd bookalimo-python
|
250
|
+
pip install -e ".[dev]"
|
251
|
+
pre-commit install
|
252
|
+
|
253
|
+
# Run tests
|
254
|
+
pytest
|
255
|
+
pytest --cov=bookalimo --cov-report=html
|
256
|
+
|
257
|
+
# Docs (MkDocs)
|
258
|
+
mkdocs serve
|
259
|
+
```
|
260
|
+
|
261
|
+
## Security Notes
|
262
|
+
|
263
|
+
* Never log raw passwords or credit card numbers.
|
264
|
+
* Store credentials securely (e.g., environment variables, secrets managers).
|
265
|
+
* Use sandbox for testing.
|
266
|
+
|
267
|
+
## License
|
268
|
+
|
269
|
+
This project is licensed under the MIT License — see [`LICENSE`](LICENSE).
|
270
|
+
|
271
|
+
## Changelog
|
272
|
+
|
273
|
+
See [`CHANGELOG.md`](CHANGELOG.md) for release history.
|