Skip to main content

Korail(www.letskorail.com) wrapper for Python

Project description

|PyPi version| |PyPi downloads|

Korail (www.letskorail.com) wrapper for Python.

This project was inspired from korail of devxoul.

korail is not working anymore becuase of a huge change in Korail API.

Documentation

The documentation is available at here

Installing

To install korail2, simply:

$ pip install korail2

Or, you can use:

$ easy_install korail2

Or, you can also install manually:

$ git clone git://github.com/carpedm20/korail2.git
$ cd korail2
$ python setup.py install

Using

1. Login

First, you need to create a Korail object.

>>> from korail2 import Korail
>>> korail = Korail("12345678", YOUR_PASSWORD) # with membership number
>>> korail = Korail("carpedm20@gmail.com", YOUR_PASSWORD) # with email
>>> korail = Korail("010-9964-xxxx", YOUR_PASSWORD) # with phone number

2. Search train

You can search train schedules search_train method. search_train method takes these arguments:

  • dep : A departure station in Korean ex) ‘서울’

  • arr : A arrival station in Korean ex) ‘부산’

  • date : (optional) A departure date in yyyyMMdd format

  • time : (optional) A departure time in hhmmss format

  • train_type: (optional) A type of train

    • 00: KTX

    • 01: 새마을호

    • 02: 무궁화호

    • 03: 통근열차

    • 04: 누리로

    • 05: 전체 (기본값)

    • 06: 공학직통

    • 07: KTX-산천

    • 08: ITX-새마을

    • 09: ITX-청춘

Below is a sample code of search_train:

>>> dep = '서울'
>>> arr = '동대구'
>>> date = '20140815'
>>> time = '144000'
>>> trains = korail.search_train(dep, arr, date, time)
[[KTX] 8월 3일, 서울~부산(11:00~13:42) [특실:1][일반실:1] 예약가능,
 [ITX-새마을] 8월 3일, 서울~부산(11:04~16:00) [일반실:1] 예약가능,
 [무궁화호] 8월 3일, 서울~부산(11:08~16:54) [일반실:0] 입석 역발매중,
 [ITX-새마을] 8월 3일, 서울~부산(11:50~16:50) [일반실:0] 입석 역발매중,
 [KTX] 8월 3일, 서울~부산(12:00~14:43) [특실:1][일반실:1] 예약가능,
 [KTX] 8월 3일, 서울~부산(12:30~15:13) [특실:1][일반실:1] 예약가능,
 [KTX] 8월 3일, 서울~부산(12:40~15:45) [특실:1][일반실:1] 예약가능,
 [KTX] 8월 3일, 서울~부산(12:55~15:26) [특실:1][일반실:1] 예약가능,
 [KTX] 8월 3일, 서울~부산(13:00~15:37) [특실:1][일반실:1] 예약가능,
 [KTX] 8월 3일, 서울~부산(13:10~15:58) [특실:1][일반실:1] 예약가능]

3. Make a reservation

You can get your tickes with tickets method.

>>> trains = korail.search_train(dep, arr, date, time)
>>> seat = korail.reserve(trains[0])
정상처리되었습니다
동일시간대 예약발매내역이 있습니다.
>>> seat
[KTX] 8월 3일, 서울~부산(11:00~:) 16호 6A

4. Get tickets already paid

You can get the list of paid tickes with tickets method.

>>> tickets = korail.tickets()
정상발매처리,정상발권처리
>>> print tickets
[[KTX] 8월 10일, 동대구~울산(09:26~09:54) => 5호 4A, 13900원]

How do I get the Korail API

  1. Extract Korail apk from mobile phone

  2. Decompile apk using dex2jar

  3. Read a jar code using jdgui

  4. Edit a smaili code

  5. Recompile a new Korail apk using apktool

  6. Key signing with motizen-sign

  7. Upload and run a new Korail apk

  8. Capture packets and analyze the API

License

Source codes are distributed under BSD license.

Author

Taehoon Kim / @carpedm20

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

korail2-0.0.2.tar.gz (8.6 kB view details)

Uploaded Source

File details

Details for the file korail2-0.0.2.tar.gz.

File metadata

  • Download URL: korail2-0.0.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for korail2-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a7f656ead145df3497e9ea994011dea6f7651110c4e989e58b0cb71a622b464f
MD5 002483b3310975afd2c9fbfb60a0623f
BLAKE2b-256 defdc017f4e707339c66d9bd0c04aafdc0bee3a72ddff04ad28c0796c99cbbe9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page