BlaBlaCar API Client Python Library
Easily search for trips!
Installation
Works on both 2.7.x and 3.x python.
pip install blablacar-api
Usage
from blablacarapi import BlaBlaCarApi
# initialize API
api = BlaBlaCarApi(api_key="__your_api_key_here__")
# fetch trips from London to Paris
trips = api.trips(frm="London", to="Paris")
# after fetching you have:
# trips.trips
# trips.top_trips
# trips.pager
# trips.facets
# trips.savings
# trips.distance
# trips.duration
# trips.recommended_price
# iterate over the trips
for trip in trips.trips:
print("%s: %s -> %s" % (trip.departure_date, trip.departure_place['address'], trip.arrival_place['address']))
# fetch data for one trip using trip id
single_trip = api.trip(trip.permanent_id)
# paging
trips.pager.has_next() # True or False
trips.pager.next() # returns 2 if the current page is 1
trips.pager.has_previous() # True or False
trips.pager.previous() # returns False if the current page is 1, and it returns 1 if current page is 2
Locales
api = BlaBlaCarApi(api_key="__your_blablacar_api_key_here__", locale="en_GB", currency="en_GB")
Debugging
If you want to debug your code using the data regarding the API call.
# initialize with debug=True
api = BlaBlaCarApi(api_key="...", debug=True)
# after every API call the client library will automatically print all the data to standard output
api.trips(...)
# and you can always have all debug data in your code
debug_data = api.request.debug.show()
Official documentation
For more information visit official documentation: https://dev.blablacar.com/docs/versions/1.0
Metadata
Release files for BlaBlaCar-API 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| BlaBlaCar API-0.2.3.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| BlaBlaCar_API-0.2.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 14.4 kB
Release files / BlaBlaCar API-0.2.3.tar.gz
| Download URL | BlaBlaCar API-0.2.3.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18c19db23cb2b446183b291ab8a9cd57a9caec308397e8512e9a067f662380bb
|
|
BLAKE2b-256 checksum How to use checksums |
927a6cfd6cf2a9f4ad8a1771d368631e79aa0392f558d644be46f6d5b9780ef7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.5
|
Release files / BlaBlaCar_API-0.2.3-py2.py3-none-any.whl
| Download URL | BlaBlaCar_API-0.2.3-py2.py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e517fc62018585588d63a27ba52a1b4f2f4d25f939c02a0914f87301883b6d93
|
|
BLAKE2b-256 checksum How to use checksums |
4cf796b1ee27b4e80bac648229f255c062040ea91d5f296996d09d440979db80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.5
|