Skip to main content

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_upsrtc-0.1.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

python_upsrtc-0.1.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file python_upsrtc-0.1.2.tar.gz.

File metadata

  • Download URL: python_upsrtc-0.1.2.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for python_upsrtc-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d3de229b4b01eac9a036e6765d2572d0bd40b034c1ad6cee3d3f7e2ee393b92b
MD5 b444f055840bbe586ab3694499408cb1
BLAKE2b-256 2f529c37850ffa62a5f8e88924ef79cde3c1d0cb10ef6352f13ffc0da2cd1394

See more details on using hashes here.

File details

Details for the file python_upsrtc-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_upsrtc-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 48f89a072f53e3a7a66a240548c8f5fdf272edb8e5b49150275d4abfc6668e22
MD5 474a1e5b38a32d6675fc8cff79893338
BLAKE2b-256 490e81b074088db18c88b50b1711f33f9ad508a1c37d022f877c0c4b54d4cb16

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page