Skip to content

fedebotu/k-trains

Repository files navigation

K-Trains 🇰🇷-🚄

Streamlit AppCode style: blackpython_sup


K-Trains

한국어 버전 클릭

Tired of not having any ticket to Suseo station because your SRT is fully booked? How about that cheap Mugunghwa ticket that you can't get because it's sold out? K-Trains is here to help you get those tickets!

K-Trains is a Streamlit app that allows you to connect to Korail and SRT's APIs to get information and reserve trains in Korea.

How to use

Web UI

You can launch the app on Streamlit here. The UI should be self-explanatory - you can simply login and pick up some trains that you would like to get notifications for or reserve them directly. If they are not available, the app will notify you when they are and reserve them for you!

Note that you still have to pay for the ticket in the Korail or SRT website/app within the time limit.

Nonetheless, still better than having to manually refresh and hope someone won't reserve the ticket before you do ;)

Manual deployment

The application is based on Streamlit which allows for web GUIs in Python. To run the application locally, run the following command:

streamlit run app.py

A web browser should open automatically and you can interact with the application. If it doesn't, you can manually open a browser and navigate to http://localhost:8501.

You can also run the script to book a ticket directly:

python reserve.py [OPTIONS]

Secrets and email API connection

The app connects to a email account API (specifically, Google), which is private. If you want to deploy the app by yourself, you may encounter the following:

FileNotFoundError: No secrets files found. Valid paths for a secrets.toml file are: C:\Users\nyancat.streamlit\secrets.toml,

You may follow this guide for managing your own secrets.toml file. Moreover, if you do not use Gmail, you should modify the email_notify function, particularly at this line.

Warning

Developers are not responsible for any misuse of this application. This application is for educational purposes only. Please use it at your own risk!

Screenshots


k-train-email

Acknowledgements

This project was made possible by the following libraries:

Feedback

If you have any feedback, please feel free to reach out and open an issue or a pull request!