Python API wrapper for bus.gal
Project description
Python API wrapper for bus.gal which uses the associated app’s http API to get the inforamtion. I got the endpoints using mitmproxy
There is also included an old implementation using selenium, which isn’t included in the package, it’s in busdotg
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.
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
busGal_api-0.0.4.2.tar.gz
(20.2 kB
view hashes)
Built Distribution
Close
Hashes for busGal_api-0.0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee5d076f1f000bb80a6b81b43e1d212f3be18d00f0f1ad1da5ccdc090cf7c477 |
|
MD5 | aeb8f6b54ae75ee36a3d7e4f9a22e251 |
|
BLAKE2b-256 | 733bfdbe318488ba8e3241738bef21648b642179231511fa6f455c1d9fb89748 |