Skip to content

kmch4n/kcb_api

Repository files navigation

Kyoto City Bus API

FastAPI server for searching Kyoto City Bus routes using GTFS (General Transit Feed Specification) data.

Features

  • 🚌 Bus Route Search: Find direct routes between two stops with departure times.
  • 💰 Fare Information: Get fare prices and stop counts for each route.
  • 📍 Nearby Stops: Find bus stops near your GPS location.
  • 🕒 Timetable: View schedules for specific stops.
  • 👁️ Bus Location: Estimate bus current location based on schedule.
  • 🚏 Boarding Assistance: Track the 3 stops before your boarding location.
  • Fast Response: GTFS data preloaded in memory.
  • 📖 Full Documentation: See API Documentation.

Quick Start

1. Install Dependencies

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

2. Setup GTFS Data

Download Kyoto City Bus data:

python update_gtfs_data.py

3. Configure Environment

cp .env.example .env
# Edit .env and set your API_KEY

4. Run Server

python main.py

Server will start at http://localhost:8000.

Documentation

  • API Specification: Detailed endpoint reference.
  • Deployment Guide: Production setup instructions.
  • Interactive Docs: Visit /kcb_api/docs in your browser when running.

Project Structure

kcb_api/
├── main.py                 # FastAPI application
├── bus_route_search.py     # Core logic
├── auth.py                 # Authentication
├── config.py               # Settings
├── docs/                   # Documentation
└── data/                   # GTFS data storage

Technology Stack

  • FastAPI
  • Uvicorn
  • Pydantic
  • GTFS

License

MIT License

About

A Python project that ingests and parses Kyoto City Bus open data, then exposes it via a self-hosted API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors