carpedm20 / korail2 Goto Github PK
View Code? Open in Web Editor NEWKorail (www.letskorail.com) wrapper for Python.
Home Page: http://carpedm20.github.io/korail2/
License: Other
Korail (www.letskorail.com) wrapper for Python.
Home Page: http://carpedm20.github.io/korail2/
License: Other
Support Python3.
Now, setup.py is describing python3 supported.
But it is wrong. Need to enhance.
search_train() 의 출력결과는 지정한 시간이후로 10개씩인데,
하루 전체를 반복해서 검색해 올 필요가 있음
예약취소기능을 구현해야 예약 테스트 자동화가 용이하므로 우선 구현필요.
펑~
먼저 바쁘신 와중에 죄송합니다!
PyPI에 패키지를 최신 버전으로 올려주십사 부탁드리고 싶습니다.
파이썬3를 사용하는 프로젝트에 이 패키지를 사용하고 있는데 PyPI에는 아직 업데이트가 안 된 것 같습니다. 지금은 직접 빌드해서 사용하고 있지만 배포할 때 PyPI에 버전이 있으면 정말 편리할 것 같습니다. 혹시 시간이 가능하실 때 올려주실 수 있을까요?
로그인에서 막힙니다. ㅠㅠ
https://github.com/carpedm20/korail2/blob/master/setup.py#L44
On windows, the file object try to use CP949 codec.
So decoding error issued on line 44 of setup.py
fix with using below code.
import codecs
with codecs.open(file name,'r',encoding='utf8') as f:
text = f.read()
펑~
9443 포트로 사용이 안되어 포트번호 변경하고 PR날렸습니다.
Hi there!
Since I wanted to find a way to buy sold-out trains, I made an app that can reserve tickets by querying the API until they are available and then automatically reserve - here is the result. It also integrates both yours and the SRT of https://github.com/ryanking13/SRT.
Thanks again for your great library!
현재 Korail
클래스의 선언입니다.
class Korail(object):
_session = requests.session()
def __init__(self, korail_id, korail_pw, auto_login=True, want_feedback=False):
self.korail_id = korail_id
...
이렇게 _session
이 클래스 변수로 선언되어 있어 서로 다른 객체가 같은 세션을 공유하게 됩니다.
이는 실제 로그인 되어있는 사용자의 아이디와 Korail
객체의 korail_id
필드가 다른 상황을 초래합니다.
k1 = Korail(USERID_1, PASSWD_1)
k2 = Korail(USERID_2, PASSWD_2) # k1과 k2의 _session은 동일한 객체라 USERID_2로 다시 로그인합니다.
k1.reserve(train) # USERID_1이 기차를 예매할 것이 예상되지만 실제로는 USERID_2가 예매하게 됩니다.
그래서 _session
을 인스턴스 변수로 옮기는게 좋을 것 같은데 어떤가요?
오랫동안 잘 써왔는데, korail api가 버전업이 되었는지 다음과 같은 에러가 나오네요ㅠ
KorailError Traceback (most recent call last)
~/Dropbox/Programming/Workspace/korail.py in <module>
24 try:
---> 25 trains = korail.search_train(dep, arr, date, depart_time, include_no_seats=True, passengers=psgrs)
26 #print(trains)
~/anaconda3/lib/python3.7/site-packages/korail2/korail2.py in search_train(self, dep, arr, date, time, train_type, passengers, include_no_seats)
774
--> 775 if self._result_check(j):
776 train_infos = j['trn_infos']['trn_info']
~/anaconda3/lib/python3.7/site-packages/korail2/korail2.py in _result_check(self, j)
620 else:
--> 621 raise KorailError(h_msg_txt, h_msg_cd)
622 else:
KorailError: 최신버전으로 업데이트하신 후 이용하여 주십시오. (SUPDATE)
현재 로그인 단계에서 자꾸 False 가 나고 있습니다. 아이디 2개로 검증해도 똑같습니다. 다른 분은 잘 작동하나요? 아니라면 어떤 문제일까요?
안녕하세요.
먼저, 이 라이브러리를 만들어주셔서 너무 고맙습니다.
너무 잘 쓰고 있어요.
다름이 아니라, search_train 에서 time 을 140000 으로 입력하면 어떤 시간대의 기차들이 잡히는지 알고 싶어서요.
주말 혹은 명절날에는 거의 안잡히고.. 여유 좌석이 있으면 금방 잡히더라구요.
만약 time 부분에 140000 을 입력하게 되면 14:00:00시부터 1초마다 1값이 증가하면서 예약 가능한 열차를 확인하나요 ??
코드를 봐도 전혀 이해가 안되네요 ㅠ
>>> print(korail.search_train('광명', '동대구', '20200129')[0])
[KTX-산천] 1월 29일, 광명~동대구(15:26~16:58) 특실,일반실 41,300원 5%적립
>>> print(korail.search_train('광명', '동대구', '20200122')[0])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "korail2/korail2.py", line 788, in search_train
raise NoResultsError()
korail2.korail2.NoResultsError: No Results (None)
특정날짜 1월 22~25일까지에는
NoResultsError 가 발생하는데, 아마 연휴 기간이라서 발생하는 에러 같습니다.
아직까지 코레일톡 공식앱에서는 잘 조회되는걸로는 보입니다.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.