Welcome to bus.gal-api’s documentation!
bus.gal-api
Python API wrapper for bus.gal which uses the associated app’s http API to get the inforamtion about buses, your card and your user account. I got the endpoints using mitmproxy.
Call for help
If you find stops which have different names but are physically the same, please open an issue. Thanks for your contribution.
Documentation
Documentation can be found here
Installation
Just run:
pip install busGal_api
Quick example
This is just a simple command-line “client”
import busGal_api as api
from datetime import datetime
def menu(results):
for i, result in enumerate(results):
print(f"{i} -- {result.name}")
return int(input("Which number you want? >>>"))
origin = input("Where do you want to start your trip? >>>")
results = api.search_stop(origin)
selection = menu(results)
origin = results[selection]
destination = input("Where do you want to go? >>>")
results = api.search_stop(destination)
selection = menu(results)
destination = results[selection]
trip = api.Trip(origin, destination, datetime.now())
if trip.expeditions == None:
print("No results")
exit()
print("\nORIGIN | DEPARTURE | DESTINATION | ARRIVAL\n")
for expedition in trip.expeditions:
print(f"{expedition.origin.name} | {expedition.departure.strftime('%H:%M')} | {expedition.destination.name} | {expedition.arrival.strftime('%H:%M')}")
Disclaimer
This project is not endorsed by, directly affiliated with, maintained by, sponsored by or in any way officially related with la Xunta de Galicia, the bus operators or any of the companies involved in the bus.gal website and the app.