From 4e4b0ad14b7913d7a13f68487576bfd1a7427674 Mon Sep 17 00:00:00 2001 From: lanseria Date: Sun, 14 Jan 2018 20:30:13 +0800 Subject: [PATCH] fix window show and add readme.md --- README.md | 5 +++++ tickets.py | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c834b9 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# install +``` +pip install docopt prettytable +python .\tickets.py 郑州 宁波 2018-02-01 +``` \ No newline at end of file diff --git a/tickets.py b/tickets.py index 2dc2405..8fec092 100644 --- a/tickets.py +++ b/tickets.py @@ -16,7 +16,7 @@ from datetime import datetime from docopt import docopt from prettytable import PrettyTable -from colorama import Fore +from colorama import Fore, init from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) @@ -85,7 +85,7 @@ def pretty_print(self): class Cli(object): url_template = ( - 'https://kyfw.12306.cn/otn/leftTicket/query?leftTicketDTO.' + 'https://kyfw.12306.cn/otn/leftTicket/queryZ?leftTicketDTO.' 'train_date={}&' 'leftTicketDTO.from_station={}&' 'leftTicketDTO.to_station={}&' @@ -122,4 +122,5 @@ def run(self): if __name__ == '__main__': + init() Cli().run()