bookalimo 0.1.5__py3-none-any.whl → 1.0.0__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.
- bookalimo/__init__.py +17 -24
- bookalimo/_version.py +9 -0
- bookalimo/client.py +310 -0
- bookalimo/config.py +16 -0
- bookalimo/exceptions.py +115 -5
- bookalimo/integrations/__init__.py +1 -0
- bookalimo/integrations/google_places/__init__.py +31 -0
- bookalimo/integrations/google_places/client_async.py +258 -0
- bookalimo/integrations/google_places/client_sync.py +257 -0
- bookalimo/integrations/google_places/common.py +245 -0
- bookalimo/integrations/google_places/proto_adapter.py +224 -0
- bookalimo/{_logging.py → logging.py} +45 -42
- bookalimo/schemas/__init__.py +97 -0
- bookalimo/schemas/base.py +56 -0
- bookalimo/{models.py → schemas/booking.py} +88 -100
- bookalimo/schemas/places/__init__.py +37 -0
- bookalimo/schemas/places/common.py +198 -0
- bookalimo/schemas/places/google.py +596 -0
- bookalimo/schemas/places/place.py +337 -0
- bookalimo/services/__init__.py +11 -0
- bookalimo/services/pricing.py +191 -0
- bookalimo/services/reservations.py +227 -0
- bookalimo/transport/__init__.py +7 -0
- bookalimo/transport/auth.py +41 -0
- bookalimo/transport/base.py +44 -0
- bookalimo/transport/httpx_async.py +230 -0
- bookalimo/transport/httpx_sync.py +230 -0
- bookalimo/transport/retry.py +102 -0
- bookalimo/transport/utils.py +59 -0
- bookalimo-1.0.0.dist-info/METADATA +307 -0
- bookalimo-1.0.0.dist-info/RECORD +35 -0
- bookalimo/_client.py +0 -420
- bookalimo/wrapper.py +0 -444
- bookalimo-0.1.5.dist-info/METADATA +0 -392
- bookalimo-0.1.5.dist-info/RECORD +0 -12
- {bookalimo-0.1.5.dist-info → bookalimo-1.0.0.dist-info}/WHEEL +0 -0
- {bookalimo-0.1.5.dist-info → bookalimo-1.0.0.dist-info}/licenses/LICENSE +0 -0
- {bookalimo-0.1.5.dist-info → bookalimo-1.0.0.dist-info}/top_level.txt +0 -0
@@ -1,392 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: bookalimo
|
3
|
-
Version: 0.1.5
|
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. Built on top of `httpx` and `pydantic`.
|
67
|
-
|
68
|
-
## Table of Contents
|
69
|
-
|
70
|
-
- [Book-A-Limo Python SDK](#book-a-limo-python-sdk)
|
71
|
-
- [Table of Contents](#table-of-contents)
|
72
|
-
- [Features](#features)
|
73
|
-
- [Requirements](#requirements)
|
74
|
-
- [Installation](#installation)
|
75
|
-
- [Quick Start](#quick-start)
|
76
|
-
- [Authentication](#authentication)
|
77
|
-
- [Core Operations](#core-operations)
|
78
|
-
- [Get Pricing](#get-pricing)
|
79
|
-
- [Book a Reservation](#book-a-reservation)
|
80
|
-
- [Location Builders](#location-builders)
|
81
|
-
- [Airport Locations](#airport-locations)
|
82
|
-
- [Address Locations](#address-locations)
|
83
|
-
- [Stops](#stops)
|
84
|
-
- [Advanced](#advanced)
|
85
|
-
- [Using Account Info (Travel Agents)](#using-account-info-travel-agents)
|
86
|
-
- [Edit / Cancel a Reservation](#edit--cancel-a-reservation)
|
87
|
-
- [Error Handling](#error-handling)
|
88
|
-
- [Logging](#logging)
|
89
|
-
- [Enable Debug Logging](#enable-debug-logging)
|
90
|
-
- [Custom Logging](#custom-logging)
|
91
|
-
- [Security](#security)
|
92
|
-
- [Disable Logging](#disable-logging)
|
93
|
-
- [Development](#development)
|
94
|
-
- [Security Notes](#security-notes)
|
95
|
-
- [License](#license)
|
96
|
-
- [Changelog](#changelog)
|
97
|
-
|
98
|
-
## Features
|
99
|
-
|
100
|
-
* **Asynchronous**
|
101
|
-
* **Fully Typed** for requests & responses
|
102
|
-
* **Input validation** including airports and addresses.
|
103
|
-
* **Clean, minimal interface** for each API operation
|
104
|
-
* **Custom exceptions & error handling**
|
105
|
-
* **Tests and examples**
|
106
|
-
|
107
|
-
## Requirements
|
108
|
-
|
109
|
-
* Python **3.9+** (`pyproject.toml` sets `requires-python = ">=3.9"`)
|
110
|
-
* An async event loop (examples use `asyncio`)
|
111
|
-
* Time strings use **`MM/dd/yyyy hh:mm tt`** (e.g., `09/05/2025 12:44 AM`)
|
112
|
-
|
113
|
-
## Installation
|
114
|
-
|
115
|
-
```bash
|
116
|
-
pip install bookalimo
|
117
|
-
```
|
118
|
-
|
119
|
-
## Quick Start
|
120
|
-
|
121
|
-
```python
|
122
|
-
import asyncio
|
123
|
-
|
124
|
-
from bookalimo import (
|
125
|
-
BookALimo,
|
126
|
-
create_credentials,
|
127
|
-
create_airport_location,
|
128
|
-
create_address_location,
|
129
|
-
)
|
130
|
-
from bookalimo.models import RateType
|
131
|
-
|
132
|
-
async def main():
|
133
|
-
# For Travel Agents (customers: pass is_customer=True)
|
134
|
-
credentials = create_credentials("TA10007", "your_password")
|
135
|
-
|
136
|
-
async with BookALimo(credentials) as client:
|
137
|
-
# Build locations
|
138
|
-
pickup = create_airport_location("JFK", "New York")
|
139
|
-
dropoff = create_address_location("53 East 34th Street, Manhattan")
|
140
|
-
|
141
|
-
prices = await client.get_prices(
|
142
|
-
rate_type=RateType.P2P,
|
143
|
-
date_time="09/05/2025 12:44 AM",
|
144
|
-
pickup=pickup,
|
145
|
-
dropoff=dropoff,
|
146
|
-
passengers=2,
|
147
|
-
luggage=3,
|
148
|
-
)
|
149
|
-
|
150
|
-
print(f"Available cars: {len(prices.prices)}")
|
151
|
-
for price in prices.prices:
|
152
|
-
print(f"- {price.car_description}: ${price.price}")
|
153
|
-
|
154
|
-
if __name__ == "__main__":
|
155
|
-
asyncio.run(main())
|
156
|
-
```
|
157
|
-
|
158
|
-
## Authentication
|
159
|
-
|
160
|
-
```python
|
161
|
-
from bookalimo import create_credentials
|
162
|
-
|
163
|
-
# Travel Agents
|
164
|
-
ta_creds = create_credentials("TA10007", "password", is_customer=False)
|
165
|
-
|
166
|
-
# Customers
|
167
|
-
cust_creds = create_credentials("customer@email.com", "password", is_customer=True)
|
168
|
-
```
|
169
|
-
|
170
|
-
## Core Operations
|
171
|
-
|
172
|
-
```python
|
173
|
-
# List Reservations
|
174
|
-
reservations = await client.list_reservations(is_archive=False)
|
175
|
-
|
176
|
-
# Get Reservation Details
|
177
|
-
details = await client.get_reservation("5452773")
|
178
|
-
```
|
179
|
-
|
180
|
-
### Get Pricing
|
181
|
-
|
182
|
-
```python
|
183
|
-
from bookalimo.models import RateType
|
184
|
-
|
185
|
-
prices = await client.get_prices(
|
186
|
-
rate_type=RateType.P2P,
|
187
|
-
date_time="09/05/2025 12:44 AM",
|
188
|
-
pickup=pickup, # Location
|
189
|
-
dropoff=dropoff, # Location
|
190
|
-
passengers=2,
|
191
|
-
luggage=3,
|
192
|
-
# Optional kwargs:
|
193
|
-
# hours=2, stops=[...], account=..., passenger=..., rewards=[...],
|
194
|
-
# car_class_code="SD", pets=0, car_seats=0, boosters=0, infants=0,
|
195
|
-
# customer_comment="..."
|
196
|
-
)
|
197
|
-
```
|
198
|
-
|
199
|
-
### Book a Reservation
|
200
|
-
|
201
|
-
```python
|
202
|
-
from bookalimo import create_credit_card, create_passenger
|
203
|
-
from bookalimo.models import CardHolderType
|
204
|
-
|
205
|
-
# Optionally set details first (select car class, add passenger, etc.)
|
206
|
-
details = await client.set_details(
|
207
|
-
token=prices.token,
|
208
|
-
car_class_code="SD",
|
209
|
-
passenger=create_passenger("John", "Smith", "+19173334455"),
|
210
|
-
)
|
211
|
-
|
212
|
-
# Book with credit card
|
213
|
-
card = create_credit_card(
|
214
|
-
number="4111 1111 1111 1111", # test PAN
|
215
|
-
card_holder="John Smith",
|
216
|
-
holder_type=CardHolderType.PERSONAL,
|
217
|
-
expiration="01/28",
|
218
|
-
cvv="123",
|
219
|
-
zip_code="10016",
|
220
|
-
)
|
221
|
-
|
222
|
-
booking = await client.book(token=prices.token, credit_card=card)
|
223
|
-
print(f"Booked! Confirmation: {booking.reservation_id}")
|
224
|
-
|
225
|
-
# Or charge account
|
226
|
-
booking = await client.book(token=prices.token, method="charge")
|
227
|
-
```
|
228
|
-
|
229
|
-
## Location Builders
|
230
|
-
|
231
|
-
### Airport Locations
|
232
|
-
|
233
|
-
```python
|
234
|
-
from bookalimo import create_airport_location
|
235
|
-
|
236
|
-
pickup = create_airport_location(
|
237
|
-
iata_code="JFK",
|
238
|
-
city_name="New York",
|
239
|
-
airline_code="UA",
|
240
|
-
flight_number="UA1234",
|
241
|
-
terminal="7",
|
242
|
-
)
|
243
|
-
```
|
244
|
-
|
245
|
-
### Address Locations
|
246
|
-
|
247
|
-
```python
|
248
|
-
from bookalimo import create_address_location
|
249
|
-
|
250
|
-
dropoff = create_address_location(
|
251
|
-
address="53 East 34th Street, Manhattan",
|
252
|
-
zip_code="10016",
|
253
|
-
)
|
254
|
-
```
|
255
|
-
|
256
|
-
### Stops
|
257
|
-
|
258
|
-
```python
|
259
|
-
from bookalimo import create_stop
|
260
|
-
|
261
|
-
stops = [
|
262
|
-
create_stop("Brooklyn Bridge", is_en_route=False),
|
263
|
-
create_stop("Empire State Building", is_en_route=True),
|
264
|
-
]
|
265
|
-
```
|
266
|
-
|
267
|
-
## Advanced
|
268
|
-
|
269
|
-
### Using Account Info (Travel Agents)
|
270
|
-
|
271
|
-
```python
|
272
|
-
from bookalimo.models import Account
|
273
|
-
|
274
|
-
account = Account(
|
275
|
-
id="TA10007",
|
276
|
-
department="Sales",
|
277
|
-
booker_first_name="Jane",
|
278
|
-
booker_last_name="Agent",
|
279
|
-
booker_email="jane@agency.com",
|
280
|
-
booker_phone="+19173334455",
|
281
|
-
)
|
282
|
-
|
283
|
-
prices = await client.get_prices(
|
284
|
-
# ... required args
|
285
|
-
account=account,
|
286
|
-
)
|
287
|
-
```
|
288
|
-
|
289
|
-
### Edit / Cancel a Reservation
|
290
|
-
|
291
|
-
```python
|
292
|
-
# Edit (e.g., add note or change passengers). Omitting fields leaves them unchanged.
|
293
|
-
edit_result = await client.edit_reservation(
|
294
|
-
confirmation="5452773",
|
295
|
-
is_cancel_request=False,
|
296
|
-
passengers=3,
|
297
|
-
other="Gate pickup",
|
298
|
-
)
|
299
|
-
|
300
|
-
# Cancel
|
301
|
-
cancel_result = await client.edit_reservation(
|
302
|
-
confirmation="5452773",
|
303
|
-
is_cancel_request=True,
|
304
|
-
)
|
305
|
-
```
|
306
|
-
|
307
|
-
## Error Handling
|
308
|
-
|
309
|
-
```python
|
310
|
-
from bookalimo.exceptions import BookALimoError
|
311
|
-
|
312
|
-
try:
|
313
|
-
reservations = await client.list_reservations()
|
314
|
-
except BookALimoError as e:
|
315
|
-
print(f"API Error: {e}")
|
316
|
-
print(f"Status Code: {e.status_code}")
|
317
|
-
print(f"Response Data: {e.response_data}")
|
318
|
-
```
|
319
|
-
|
320
|
-
## Logging
|
321
|
-
|
322
|
-
By default, no log messages appear. Enable logging for debugging or monitoring.
|
323
|
-
|
324
|
-
### Enable Debug Logging
|
325
|
-
|
326
|
-
```python
|
327
|
-
import bookalimo
|
328
|
-
|
329
|
-
bookalimo.enable_debug_logging()
|
330
|
-
|
331
|
-
async with bookalimo.BookALimo(credentials) as client:
|
332
|
-
reservations = await client.list_reservations() # Shows API calls, timing, etc.
|
333
|
-
```
|
334
|
-
|
335
|
-
Or use the environment variable:
|
336
|
-
```bash
|
337
|
-
export BOOKALIMO_LOG_LEVEL=DEBUG
|
338
|
-
```
|
339
|
-
|
340
|
-
### Custom Logging
|
341
|
-
|
342
|
-
```python
|
343
|
-
import logging
|
344
|
-
import bookalimo
|
345
|
-
|
346
|
-
logging.basicConfig(level=logging.INFO)
|
347
|
-
bookalimo.get_logger().setLevel(logging.WARNING) # Production setting
|
348
|
-
```
|
349
|
-
|
350
|
-
### Security
|
351
|
-
|
352
|
-
Sensitive data is automatically redacted in logs:
|
353
|
-
- Passwords, tokens, CVV codes: `******`
|
354
|
-
- API keys: `abc123…89` (first 6, last 2 chars)
|
355
|
-
- Emails: `j***@example.com`
|
356
|
-
- Credit cards: `**** **** **** 1234`
|
357
|
-
|
358
|
-
### Disable Logging
|
359
|
-
|
360
|
-
```python
|
361
|
-
bookalimo.disable_debug_logging()
|
362
|
-
```
|
363
|
-
|
364
|
-
## Development
|
365
|
-
|
366
|
-
```bash
|
367
|
-
# Clone & setup
|
368
|
-
git clone https://github.com/yourusername/bookalimo-python.git
|
369
|
-
cd bookalimo-python
|
370
|
-
pip install -e ".[dev]"
|
371
|
-
pre-commit install
|
372
|
-
|
373
|
-
# Run tests
|
374
|
-
pytest
|
375
|
-
pytest --cov=bookalimo --cov-report=html
|
376
|
-
|
377
|
-
# Docs (MkDocs)
|
378
|
-
mkdocs serve
|
379
|
-
```
|
380
|
-
|
381
|
-
## Security Notes
|
382
|
-
|
383
|
-
* Never log raw passwords or credit card numbers.
|
384
|
-
* Store credentials securely (e.g., environment variables, secrets managers).
|
385
|
-
|
386
|
-
## License
|
387
|
-
|
388
|
-
This project is licensed under the MIT License — see [`LICENSE`](LICENSE).
|
389
|
-
|
390
|
-
## Changelog
|
391
|
-
|
392
|
-
See [`CHANGELOG.md`](CHANGELOG.md) for release history.
|
bookalimo-0.1.5.dist-info/RECORD
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
bookalimo/__init__.py,sha256=rzbMBdkp0hIIQJ8AVLHeA6y4YrNIezfzUxP2iNcRBaw,691
|
2
|
-
bookalimo/_client.py,sha256=-kpaWBeEwFcXL28he0zFpx557jcZTUcx_NTjraSHSPQ,14537
|
3
|
-
bookalimo/_logging.py,sha256=xXpdUZ33vdIrbIReLTwWOIrGtxhvYcI1thV9rJ29Lsk,7120
|
4
|
-
bookalimo/exceptions.py,sha256=ubOUZiXGEOWZvXyz2D5f5zwxBlQZVDBv1uOPmokAQ6Q,404
|
5
|
-
bookalimo/models.py,sha256=-gvxrT7llrYLxSHWn3vpmvkQqnk2ejSd97Sw8BxgBLw,16420
|
6
|
-
bookalimo/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
7
|
-
bookalimo/wrapper.py,sha256=tusu2D4CkQqI7VKxSh62bK9hvleNHjuGD_6EpsWi2xg,13381
|
8
|
-
bookalimo-0.1.5.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
bookalimo-0.1.5.dist-info/METADATA,sha256=I13Y5Ac15h6uXcDi4KvVEncHHEej4Dkyt390EXuwooY,10739
|
10
|
-
bookalimo-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
-
bookalimo-0.1.5.dist-info/top_level.txt,sha256=ZgYiDX2GfZCp4pevWn4X2qyEr-Dh7-cq5Y1j2jMhB1s,10
|
12
|
-
bookalimo-0.1.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|