Python API wrapper for bus.gal
Project description
Python API wrapper for bus.gal which uses both Selenium with Beautiful Soup and normal http requests to get the inforamtion
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} | {expedition.departure.strftime('%H:%M')} | {expedition.destination} | {expedition.arrival.strftime('%H:%M')}")
Free TechTip for you: Set the MOZ_HEADLESS env bar to anything for this to run Firefox in headless mode.
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.3.tar.gz
(17.5 kB
view hashes)
Built Distribution
busGal_api-0.0.3-py3-none-any.whl
(17.9 kB
view hashes)
Close
Hashes for busGal_api-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aed0f216210d3bab7701b34bd4854b7790eed031318c576cea36aad28819f33a |
|
MD5 | ddeddca8a1b23d456b56e2300a65bb00 |
|
BLAKE2b-256 | 622e7093fa60b24626f0af19221d0b83717899871cef79cfb65bb8586692b244 |