A Flask-based application designed to track all buses in Taipei City. The application integrates with the TDX Transport Data Exchange Service Platform's API to fetch real-time bus data.
Before running the application, there are several steps you need to take:
- Register for a dedicated API key at the TDX Transport Data Exchange Service Platform.
- Register for the Gmail email sending service to obtain the necessary credentials.
- Fill in your private credentials in the
app.env.dev
file. Once done, renameapp.env.dev
toapp.env
. Theapp.env
file should contain:BUS_APP_ID
: Your API ID from the TDX platformBUS_APP_KEY
: Your API Key from the TDX platformMAIL_USERNAME
: Your registered Gmail service usernameMAIL_PASSWORD
: Your Gmail service register password
- Run the application :
docker-compose up --build
- Real-time Bus Information: Send a request to
127.0.0.1/bus/<bus_number>
to receive real-time bus information. This includes the bus number, direction, and estimated arrival times for each stop. For a sample payload, refer tobus_simulation.json
. - Email Notification Subscription: Send a request to
127.0.0.1/subscribe/<email>/<bus_number>/<direction>/<station>
to subscribe to notifications for a specific bus stop. You'll receive an email notification 3 minutes before the bus arrives at your subscribed stop. To see an example of a user's subscription payload, refer touser_simulation.json
.
- Email Sending Simulation: Due to recent changes in Gmail's policies, the email sending functionality is currently in a simulation state. It's not entirely suitable for app scenario, so alternate solutions are being developed.
Your feedback is valuable to help improve this application. If you encounter any issues or have suggestions, please create an issue on this repository. Contributions are also welcome!