koreantrain
Unified Python API for Korean train reservation — supports both SRT and KTX (Korail) with a single interface.
Installation
pip install koreantrain
Usage
from koreantrain import SRTService, KorailService, Passenger
# SRT
srt = SRTService("id", "pw")
trains = srt.search("수서", "부산", "20260301", "140000", time_limit="200000")
reservation = srt.reserve(trains[0], passengers=[Passenger.adult(2)])
print(reservation) # [SRT] 03월 01일, 수서~부산(14:00~16:30) 53700원(2석), 구입기한 ...
# Korail (KTX) — same interface
korail = KorailService("id", "pw", train_type="ktx")
trains = korail.search("서울", "부산", "20260301", "140000", time_limit="200000")
reservation = korail.reserve(trains[0], passengers=[Passenger.adult(2)])
# Cancel
srt.cancel(reservation)
Passenger Types
Passenger.adult(count=1)
Passenger.child(count=1)
Passenger.senior(count=1)
Passenger.toddler(count=1) # Korail only
Seat Type
from koreantrain import SeatType
srt.reserve(train, seat_type=SeatType.SPECIAL_FIRST)
# GENERAL_FIRST (default), GENERAL_ONLY, SPECIAL_FIRST, SPECIAL_ONLY
Error Handling
from koreantrain import LoginError, SoldOutError, NetworkError, ReservationError
try:
srt.reserve(train)
except SoldOutError:
print("매진")
except LoginError:
print("로그인 만료")
except NetworkError:
print("네트워크 오류")
Dependencies
Metadata
Release files for koreantrain 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| koreantrain-0.1.0.tar.gz | 5.2 kB | Without provenance | Details for koreantrain-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| koreantrain-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for koreantrain-0.1.0-py3-none-any.whl |
Total release size: 11.5 kB
Release files / koreantrain-0.1.0.tar.gz
| Download URL | koreantrain-0.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a18c9b220d641a3bb105c53c2186bd4314e855633a228242b9048c6b49b5ca4c
|
|
BLAKE2b-256 checksum How to use checksums |
6b0f420c2ed9bf8220bb0cc072062a480fddf554c28cc46e5219eae86e9a4acf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Release files / koreantrain-0.1.0-py3-none-any.whl
| Download URL | koreantrain-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68545173cef8f97119f2294e426f67bfb4cd4c8ae78e0414a283653f03a24b0b
|
|
BLAKE2b-256 checksum How to use checksums |
fb075b9b448a270bf112b0909c4f38bef087596a2da80d86da96b5b33a50afa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Security for koreantrain 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.