marta-python
Python library for accessing MARTA real-time API
Installing
pip install marta-python
Using
Declare a new instance of the MARTA RailClient or BusClient class:
from marta import RailClient
rail_api = RailClient(api_key="MY_API_KEY")
There are methods available for accessing MARTA train and bus data, many of which accept optional parameters to filter the results.
from marta import RailClient, BusClient, Direction, TrainLine
rail_api = RailClient(api_key="MY_API_KEY")
bus_api = BusClient(api_key="MY_API_KEY")
# Get all buses (via legacy API)
buses = bus_api.get_buses()
# Get buses by route
buses = bus_api.get_buses(route=1)
# Get buses by route and stop_id
buses = bus_api.get_buses(route=1, stop_id=900800)
# Get buses by route and vehicle_id
buses = bus_api.get_buses(route=1, vehicle_id=1405)
# Get buses by route and timepoint
buses = bus_api.get_buses(route=1, time_point="West End Station")
# Get buses by route, stop_id and vehicle_id
buses = bus_api.get_buses(route=1, stop_id=900800, vehicle_id=1405)
# Get all rail station arrivals
arrivals = rail_api.get_arrivals()
# Get trains by line, station and direction
arrivals = rail_api.get_arrivals().on_line(TrainLine.RED).arriving_at("FIVE POINTS STATION").heading(Direction.NORTH)
There are other train and bus methods available that utilize other MARTA APIs.
from marta import BusClient, RailClient
bus_api = BusClient(api_key="MY_API_KEY")
rail_api = RailClient(api_key="MY_API_KEY")
# Get all bus locations (via GTFS API) (preferred)
bus_locations = bus_api.get_bus_locations_from_gtfs()
# Get all bus routes (via real-time map API)
bus_locations = bus_api.get_bus_locations_from_map()
# Get all trains (via real-time API)
trains = rail_api.get_real_time_trains()
# Get all trains (via secondary real-time map API)
trains = rail_api.get_trains_from_map()
Each method returns a list of objects that represent the trains or buses.
Metadata
Release files for marta-python 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| marta-python-0.3.0.tar.gz | 15.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| marta_python-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.0 kB
Release files / marta-python-0.3.0.tar.gz
| Download URL | marta-python-0.3.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc256ace27a286dc79530343fd746671e71bcae3653dddca2287628517cf6fa7
|
|
BLAKE2b-256 checksum How to use checksums |
4e102ddadf201085af380089dff5194f5808381fdcf31a99823427005492dceb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Release files / marta_python-0.3.0-py3-none-any.whl
| Download URL | marta_python-0.3.0-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6984f64d0d5c1864f7995273b143d36a6f5ca206c4d65c7bb3081d28c1bca82
|
|
BLAKE2b-256 checksum How to use checksums |
9fcc9691a99be3d5be9cc13efa9a030dc5bb990efd5af9f929bcaf192ce3f07a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|