A Python client for the Department for Transport Bus Open Data Service API
Project description
bods-client
A Python client for the Department for Transport Bus Open Data Service API
Installation
pip install bods-client
Example
GTFS RT
All the vehicle locations for vehicles in a geographical location can be obtained
using the get_gtfs_rt_data_feed
method with a boundng box.
from bods_client.client import BODSClient
from bods_client.models import BoundingBox
# An API key can be obtained by registering with the Bus Open Data Service
# https://data.bus-data.dft.gov.uk/account/signup/
>> API_KEY = "api-key"
>> bods = BODSClient(api_key=API_KEY)
>> box = BoundingBox(min_longitude=-0.54, min_latitude=51.26, max_longitude=0.27, max_latitide=51.75)
>> message = bods.get_gtfs_rt_data_feed(bounding_box=box)
>> message.entity[0]
id: "421354378097713049"
vehicle {
trip {
trip_id: ""
route_id: ""
}
position {
latitude: 51.712860107421875
longitude: -0.38401100039482117
bearing: 170.0
}
timestamp: 1614396229
vehicle {
id: "7214"
}
}
This returns a google.transit.gtfs_realtime_pb2.FeedMessage
object. More details about
General Transit Feed Specification Realtime Transit (GTFS-RT) can be found
here.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bods-client-0.2.0.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for bods_client-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b96302ccc7547832c333de9099093d6848dcbdc5b11534813913895c6ad17d9a |
|
MD5 | e96b0271765bea028484708cb6f04622 |
|
BLAKE2b-256 | 8bc16f222359aee756b6296f810866845e538206a58d218ba545b0119339266c |