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.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

python_upsrtc-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_upsrtc-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 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.1.tar.gz
Algorithm Hash digest
SHA256 a4fe411c53a75d584419728b613dfecd38d3763116ca35a343ed6e81718e2d6e
MD5 6fac85bc515fa14a65784bbeb3ec9f00
BLAKE2b-256 9d524ca4dabc6f1c56be684f5442a6fab6daec631f6e3da86d9d175d25150599

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_upsrtc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ac3e4aa773b8c072cade740cb1618ff0bbc3266f717dd90c007157382400385
MD5 f8df8f82ded8bcd8054976b8688907d8
BLAKE2b-256 f08d8b1286ffcc627425402a66dd406fa31ea7b1a02725efff673c8f95b43390

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