shenh10 / trainticket_booker Goto Github PK
View Code? Open in Web Editor NEW火车票刷票脚本
火车票刷票脚本
非常棒,代码结构好清新,我想参与到这个开源里
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80
class Ticket(object):
def __init__(self, config_file):
## config parser setting
self.config_file = config_file
self.settings = configparser.ConfigParser()
self.settings._interpolation = configparser.ExtendedInterpolation()
self.settings.read(self.config_file)
## environment setting
self.brower='chrome'
self.b = Browser(driver_name=self.brower)
self.station={}
self.url = "https://kyfw.12306.cn/otn/leftTicket/init"
这样做合适吗?
self.url = "https://kyfw.12306.cn/otn/leftTicket/init"
经安全检查,该站点存在以下安全风险:
(一)含有木马/病毒或钓鱼
(二)泄露
(三)包含敏感政治话题、色情等内容
这样做合适吗?这样做合适吗?这样做合适吗?!!!
如下,在输入c后报错,浏览器停留在登录后的初试页面不动
(Pdb) c
Try 1 times
date: 2018-02-12, from 北京, to 杭州
Traceback (most recent call last):
File "crawler.py", line 273, in executor
this_train = self.checkTicket(date, fromStation, toStation)
File "crawler.py", line 164, in checkTicket
self.b.add_cookie({'name': '_jc_save_fromStation', 'value': self.station[fromStation]})
File "F:\Application\Python\python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 872, in add_cookie
self.execute(Command.ADD_COOKIE, {'cookie': cookie_dict})
File "F:\Application\Python\python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "F:\Application\Python\python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: missing 'value'
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.16299 x86_64)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "crawler.py", line 323, in
ticket_theif.executor()
File "crawler.py", line 283, in executor
except {IOError, RuntimeError, TypeError, NameError} as e:
TypeError: catching classes that do not inherit from BaseException is not allowed
您好,我在使用时可登录,但登录后在cmd输入c,没有进行刷票,希望得到您的帮助,谢谢,以下是部分输出信息。
////////////////////////////以下是输出信息//////////////////////////////
DevTools listening on ws://127.0.0.1:12598/devtools/browser/308198b8-749f-4696-8cd3-f88d71ff8225 exception on 广州!
exception on 南宁东!
宸叉墦寮€闊充箰鎻愰啋
[3768:3472:0112/153605.306:ERROR:service_manager.cc(157)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: blink::mojom::ReportingServiceProxy exposed by: content_browser
--Return--
d:\eclipse-workspace\trainticket_booker\crawler.py(139)login()->None
-> pdb.set_trace()
(Pdb)
////////////////配置文件//////////////
new 1.txt
hi 你好,
我在运行的时候,报了一个错,如下所示。
好像是编码错误。请问怎么解决呢
谢谢
$ python crawler.py
Traceback (most recent call last):
File "crawler.py", line 274, in <module>
ticket_theif = Ticket('./conf/conf.ini')
File "crawler.py", line 16, in __init__
self.settings.read(self.config_file)
File "C:\Python27\lib\site-packages\backports\configparser\__init__.py", line 705, in read
self._read(fp, filename)
File "C:\Python27\lib\site-packages\backports\configparser\__init__.py", line 1035, in _read
for lineno, line in enumerate(fp, start=1):
File "C:\Python27\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 27: character maps to <undefined>
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.