Official Python SDK for the Metro Route Premium API.
Project description
Metro Route SDK (Python)
The official, highly optimized Python client library for the Metro Route Premium API. This SDK provides seamless, programmatic access to real-time data, station information, and journey planning for both the Delhi Metro (DMRC) and the Noida Metro (NMRC).
🚀 Installation
pip install metro-route-sdk
💻 Quick Start
This SDK provides both a standard synchronous client (MetroRouteClient) and an asynchronous client (AsyncMetroRouteClient) for modern, high-performance web frameworks like FastAPI.
Asynchronous Example (Recommended)
import asyncio
from metro_route import AsyncMetroRouteClient
async def main():
async with AsyncMetroRouteClient() as client:
# Get all operating lines in Delhi
lines = await client.get_lines()
print(f"Found {len(lines)} metro lines!")
# Plan a journey on the Noida Metro Aqua Line
journey = await client.plan_nmrc_journey(from_station_id="1", to_station_id="16")
print(f"Fare: ₹{journey['fare']}, Stations: {journey['stations_count']}")
asyncio.run(main())
Synchronous Example
from metro_route import MetroRouteClient
client = MetroRouteClient()
details = client.get_station_details("RG") # Rajiv Chowk
print(details)
client.close()
📚 Full API Reference
Both MetroRouteClient and AsyncMetroRouteClient expose the exact same methods (the async version just requires await).
🚆 Delhi Metro (DMRC) Endpoints
1. get_lines()
Fetches a list of all currently operating Delhi Metro lines, including their hex colors and terminal stations.
- Returns:
List[dict]
2. get_stations_by_line(line_code: str)
Retrieves every station on a specific line sequentially.
- Parameters:
line_code(str): The identifier for the line (e.g.,"YELLOW","BLUE").
- Returns:
List[dict]
3. search_stations(name: str)
Fuzzy-searches for stations matching the given name query.
- Parameters:
name(str): Search term (e.g.,"Rajiv").
- Returns:
List[dict]
4. get_station_details(station_code: str)
Retrieves comprehensive details about a specific station, including gates, platforms, and interchange information.
- Parameters:
station_code(str): The station's unique code (e.g.,"RG"for Rajiv Chowk).
- Returns:
dict
5. plan_journey(from_station: str, to_station: str)
Calculates the optimal route between two DMRC stations, providing the exact fare, travel time, and a step-by-step path including interchanges.
- Parameters:
from_station(str): Starting station code.to_station(str): Destination station code.
- Returns:
dict
6. get_notifications()
Fetches the latest official alerts, delays, and notifications directly from DMRC.
- Returns:
List[dict]
🚊 Noida Metro (NMRC) Endpoints
7. get_nmrc_stations()
Fetches all operational stations on the Noida Metro Aqua Line.
- Returns:
List[dict]
8. plan_nmrc_journey(from_station_id: str, to_station_id: str)
Calculates the fare and route for a journey entirely within the Aqua Line network.
- Parameters:
from_station_id(str): Numeric string ID of the starting station (e.g.,"1"for Sector 51).to_station_id(str): Numeric string ID of the destination station.
- Returns:
dict
⚙️ Configuration
By default, the client points to the live production server. You can override the base_url during initialization if you are hosting the API yourself:
client = MetroRouteClient(base_url="http://localhost:8000/api/v2")
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file metro_route_sdk-0.1.1.tar.gz.
File metadata
- Download URL: metro_route_sdk-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c4a052c7d38be04c6fac46ff401bf222da3d1228e2e264d56bbae86f569fc5c
|
|
| MD5 |
f5d23cbba13829a71f424bd6142e5242
|
|
| BLAKE2b-256 |
fa6f2ed422d6bd1f1570781065004c9093f99412c0d5cb99c77b3845a5d77d61
|
File details
Details for the file metro_route_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: metro_route_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e161f67c30a40bc2034933c1a75f04fa5e77bd3b7ee7c839cae6f00e8e4fe8d4
|
|
| MD5 |
cdcc1ebfb890808e9b7952636883e14c
|
|
| BLAKE2b-256 |
4b55e65663f176d4c2918198289593a67b382a849a988ace235a304e87e088dd
|