GithubHelp home page GithubHelp logo

srt_reservation's Introduction

Python program for booking SRT ticket.

매진된 SRT 표의 예매를 도와주는 파이썬 프로그램입니다.
원하는 표가 나올 때 까지 새로고침하여 예약을 시도합니다.

다운

git clone https://github.com/kminito/srt_reservation.git

필요

  • 파이썬 3.7, 3.9에서 테스트 했습니다.
pip install -r requirements.txt

Arguments

dpt: SRT 출발역
arr: SRT 도착역
dt: 출발 날짜 YYYYMMDD 형태 ex) 20220115
tm: 출발 시간 hh 형태, 반드시 짝수 ex) 06, 08, 14, ...
num: 검색 결과 중 예약 가능 여부 확인할 기차의 수 (default : 2)
reserve: 예약 대기가 가능할 경우 선택 여부 (default : False)

station_list = ["수서", "동탄", "평택지제", "천안아산", "오송", "대전", "김천(구미)", "동대구",
"신경주", "울산(통도사)", "부산", "공주", "익산", "정읍", "광주송정", "나주", "목포"]

간단 사용법

회원번호 1234567890
비밀번호 000000
동탄 -> 동대구, 2022년 01월 17일 오전 8시 이후 기차
검색 결과 중 상위 2개가 예약 가능할 경우 예약

python quickstart.py --user 1234567890 --psw 000000 --dpt 동탄 --arr 동대구 --dt 20220117 --tm 08

Optional
예약대기 사용 및 검색 결과 상위 3개의 예약 가능 여부 확인

python quickstart.py --user 1234567890 --psw 000000 --dpt 동탄 --arr 동대구 --dt 20220117 --tm 08 --num 3 --reserve True

실행 결과

기타

명절 승차권 예약에는 사용이 불가합니다.

srt_reservation's People

Contributors

kminito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

srt_reservation's Issues

ModuleNotFoundError: No module named 'webdriver_manager'

안녕하세요. SRT 매크로 정말 잘 쓰고 있습니다.

본 repository에 작성된 README.md를 따라 최초 설치 시 본 제목과 같은 에러가 발생합니다.
이 후 webdriver_manager를 별도 설치한 후에는 정상 작동됩니다.
해당 모듈을 requirements.txt에 추가해야 할 것으로 보이는데 확인 부탁드립니다.

제가 테스트한 환경은 conda이며, python 3.7 버전으로 진행하였고 다음과 같이 env 생성 후 진행하였습니다.
conda create -n srt python=3.7

config 파일 분리

로그인 정보 입력 및 텔레그램 알람 발송을 위한 설정 파일 분리

alert창이 뜨는 예외사항이 있습니다.

image
첨부한 이미지와 같이 alert창이 생기는 경우 예외처리가 되어있지 않습니다.
추가로 예약대기를 누른 경우 성공적으로 예약대기는 되지만 에러와 함께 프로그램이 종료됩니다.

예약 대기 사용: True
예약 대기 완료
Traceback (most recent call last):
  File "C:\project\srt_reservation_fork\srt_reservation\quickstart.py", line 23, in <module>
    srt.run(login_id, login_psw)
  File "C:\project\srt_reservation_fork\srt_reservation\srt_reservation\main.py", line 196, in 
run
    self.check_result()
  File "C:\project\srt_reservation_fork\srt_reservation\srt_reservation\main.py", line 172, in 
check_result
    standard_seat = self.driver.find_element(By.CSS_SELECTOR, f"#result-form > fieldset > div.tbl_wrap.th_thead > table > tbody > tr:nth-child({i}) > td:nth-child(7)").text
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\remote\webdriver.py", line 738, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute
    self.error_handler.check_response(response)
  File "C:\Users\...\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#result-form > fieldset > div.tbl_wrap.th_thead > 
table > tbody > tr:nth-child(4) > td:nth-child(7)"}
  (Session info: chrome=118.0.5993.71); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception      
Stacktrace:
        GetHandleVerifier [0x00007FF7B6CA8EF2+54786]
        (No symbol) [0x00007FF7B6C15612]
        (No symbol) [0x00007FF7B6ACA64B]
        (No symbol) [0x00007FF7B6B0B79C]
        (No symbol) [0x00007FF7B6B0B91C]
        (No symbol) [0x00007FF7B6B46D87]
        (No symbol) [0x00007FF7B6B2BEAF]
        (No symbol) [0x00007FF7B6B44D02]
        (No symbol) [0x00007FF7B6B2BC43]
        (No symbol) [0x00007FF7B6B00941]
        (No symbol) [0x00007FF7B6B01B84]
        GetHandleVerifier [0x00007FF7B6FF7F52+3524194]
        GetHandleVerifier [0x00007FF7B704D800+3874576]
        GetHandleVerifier [0x00007FF7B7045D7F+3843215]
        GetHandleVerifier [0x00007FF7B6D45086+694166]
        (No symbol) [0x00007FF7B6C20A88]
        (No symbol) [0x00007FF7B6C1CA94]
        (No symbol) [0x00007FF7B6C1CBC2]
        (No symbol) [0x00007FF7B6C0CC83]
        BaseThreadInitThunk [0x00007FFFEAF07614+20]
        RtlUserThreadStart [0x00007FFFECE826B1+33]
        ```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.