An unofficial python wrapper for UPSRTC internal API
Project description
UPSRTC Bus Tracker
Unofficial python wrapper around UPSRTC internal API for planning bus journey.
Prerequisites
- python > 3.9
- requests >=2.3.0
Usage
Install library
- Install using pip.
pip install python_upsrtc
Generate UPSRTC object
To generate a UPSRTC object, you can use the following code:
from python_upsrtc import UPSRTC as UP
u = UP()
Get Bus Stops Data
To get bus Stops data, use the following code:
u.get_bus_stops()
# Raises apiError if api request fails.
# raises noBusStopFoundError if no bus stop can be loaded.
print(u.bus_stops)
# List(BusStop)
It fetches a list of BusStop object stored in bus_stops attribute
See BusStop for its related methods and attributes.
Find Buses between stations.
from datetime import datetime
#set start station
u.set_start_station("7381") # get station code from bus stops data
u.set_end_station("8778")
u.set_start_date( datetime.now() ) # Set the start date (requires a datetime object as date )
u.find_buses()
# raises NOJourneyFoundError if no bus are found
# raises InvalidSearchSettingsError if search settings are not filled correctly or are empty.
print( u.journey )
# List( Ticket )
It fetches a list of Ticket attributes stored in journey attribute.
See Ticket for its related methods and attributes.
TODO
- Implement custom rotating proxy
- Automatic proxy fetching.
- Include Fare distribution in Ticket object.
Documentation
Checkout the documentation here
Authors
- Mohd Sabahat : mohd.sabahat123@gmail.com
Notice
NOTE : I am not affiliated or endorsed with UPSRTC. This is just an API wrapper around their already existing internal, and i am not responsible for any knd of damage that might cause using this code.
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
Built Distribution
Hashes for python_upsrtc-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ac3e4aa773b8c072cade740cb1618ff0bbc3266f717dd90c007157382400385 |
|
MD5 | f8df8f82ded8bcd8054976b8688907d8 |
|
BLAKE2b-256 | f08d8b1286ffcc627425402a66dd406fa31ea7b1a02725efff673c8f95b43390 |