• 欢迎访问db1024网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏db1024吧

py12306:一个带Web管理界面的12306购票助手,支持多账号/多线程/微信电话通知

网络资源 Liam 1年前 (2019-05-02) 822次浏览 20个评论 扫描二维码
文章目录[隐藏]

说明:前几天看到了个很强大的新项目,py12306购票助手,支持分布式,多账号,多任务购票,还带了很方便的Web管理界面,支持各种通知,比如微信,电话语音,邮件等。现在貌似到了抢票的季节了,所以博主就分享一下该工具的手动安装和Docker安装,有需求的可以用下。

截图

py12306:一个带Web管理界面的12306购票助手,支持多账号/多线程/微信电话通知
py12306:一个带Web管理界面的12306购票助手,支持多账号/多线程/微信电话通知

功能

  • 多日期查询余票
  • 自动打码下单
  • 用户状态恢复
  • 电话语音通知
  • 多账号、多任务、多线程支持
  • 单个任务多站点查询
  • 分布式运行
  • Docker支持
  • 动态修改配置文件
  • 邮件通知
  • Web管理页面
  • 微信消息通知

手动安装

Github地址:https://github.com/pjialin/py12306

环境要求:Python 3.6以上的版本。

1、安装Python 3.6
这里博主还是和以前一样提供一个脚本安装,要是你会手动安装的话,还是建议手动下。

#CentOS系统 wget https://www.moerats.com/usr/shell/Python3/CentOS_Python3.6.sh && sh CentOS_Python3.6.sh  #Debian系统 wget https://www.moerats.com/usr/shell/Python3/Debian_Python3.6.sh && sh Debian_Python3.6.sh  #由于Ubuntu 16+自带Python3,所以只需要安装pip3就可以了 apt install python3-pip -y 

2、安装依赖

git clone https://github.com/pjialin/py12306 cd py12306 pip3 install -r requirements.txt 

3、配置程序

#复制配置文件 cp env.py.example env.py 

然后编辑该配置文件,填入你的账号等信息,建议使用FTP工具访问VPS后编辑该文件。

#部分配置说明,其它配置就参考配置文件里面的说明,挺详细了 1、自动打码 目前支持免费打码,和若快打码     注:免费打码无法保证持续可用,如失效请手动切换到若快平台,需要先到http://www.ruokuai.com注册一个账号后填写到配置中。  2、语音通知 语音验证码使用的是阿里云API市场上的一个服务商,需要到https://market.aliyun.com/products/57126001/cmapi019902.html 购买后将appcode填写到配置中。 

4、测试程序
目前提供了一些简单的测试,包括用户账号检测,乘客信息检测,车站检测等

#开始测试 python3 main.py -t  #测试通知消息(语音, 邮件) python3 main.py -t -n 

5、启动程序
测试无误后,就可以开始启动了,使用命令:

#启动命令 python3 main.py  #可用参数列表,用法见4步骤 -t 测试配置信息 -t -n 测试配置信息以及通知消息 -c 指定自定义配置文件位置

然后Web管理界面自动开启,访问地址为ip:8008。如果打不开建议检查下防火墙端口,使用命令:

#CentOS 6 iptables -I INPUT -p tcp --dport 8008 -j ACCEPT service iptables save service iptables restart  #CentOS 7 firewall-cmd --zone=public --add-port=8008/tcp --permanent firewall-cmd --reload

像有些服务商可能还需要在后台开启下端口。

Docker安装

1、安装Docker

#CentOS 6 rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm yum update -y yum -y install docker-io service docker start chkconfig docker on  #CentOS 7、Debian、Ubuntu curl -sSL https://get.docker.com/ | sh systemctl start docker systemctl enable docker.service 

2、配置程序

#新建文件夹存放配置文件 mkdir py12306 && cd py12306 wget -O env.py https://raw.githubusercontent.com/pjialin/py12306/master/env.docker.py.example

然后编辑env.py配置文件,可以参考上面的手动安装步骤。

3、启动容器

#该命令记得在步骤2建立的py12306文件夹运行,data为存放数据的文件夹 docker run -d -p 8008:8008 -v $(pwd):/config -v data:/data pjialin/py12306

然后Web界面访问地址就是ip:8008,其它的问题参考上面的吧。

关于防封

目前查询和登录操作是分开的,查询是不依赖用户是否登录,放在腾讯云和阿里云上容易被限制ip,建议在其它网络环境下运行。

关于分布式集群功能,个人使用的话就没必要用了,有兴趣的可以访问上方的Github地址查看,最后希望还没票的能早点抢到票回家过年。


db1024 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:py12306:一个带Web管理界面的12306购票助手,支持多账号/多线程/微信电话通知
喜欢 (0)
关于作者:
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(20)个小伙伴在吐槽
  1. Hey! Someone in my Myspace group shared this site with us so I came to look it over. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Terrific blog and excellent design and style.
    black mass2020-08-31 06:59 回复 Windows 7 | 360浏览器 SE
  2. I got this site from my pal who shared with me concerning this website and now this time I am visiting this web site and reading very informative articles or reviews here.
    cheap flights2020-08-27 19:04 回复 Linux | Chrome 56.0.2924.87
  3. Somebody necessarily assist to make seriously articles I would state. That is the first time I frequented your website page and so far? I surprised with the analysis you made to make this particular publish incredible. Magnificent task! 2CSYEon cheap flights
    cheap flights2020-08-26 16:55 回复 Windows 7 | Internet Explorer 9.0
  4. Hello! This is kind of off topic but I need some guidance from an established blog. Is it difficult to set up your own blog? I'm not very techincal but I can figure things out pretty quick. I'm thinking about making my own but I'm not sure where to start. Do you have any ideas or suggestions? Thanks
    cheap flights2020-08-24 12:08 回复 Linux | Chrome 65.0.3325.181
  5. I pay a quick visit each day a few web sites and blogs to read articles, except this weblog gives feature based articles.
    best web hosting company2020-08-14 11:12 回复 Linux | Chrome 66.0.3359.181
  6. With havin so much content do you ever run into any problems of plagorism or copyright violation? My blog has a lot of exclusive content I've either authored myself or outsourced but it appears a lot of it is popping it up all over the internet without my permission. Do you know any techniques to help prevent content from being ripped off? I'd certainly appreciate it.
    web hosting company2020-08-12 01:43 回复 Linux | Safari浏览器 605.1.15
  7. Your style is so unique in comparison to other folks I've read stuff from. Thanks for posting when you've got the opportunity, Guess I'll just book mark this web site.
    web hosting2020-08-07 20:39 回复 Windows 7 | Internet Explorer 10.0
  8. I’m not that much of a internet reader to be honest but your sites really nice, keep it up! I'll go ahead and bookmark your site to come back later on. Many thanks
    web hosting reviews2020-08-07 02:10 回复 Linux | Chrome 66.0.3359.139
  9. We stumbled over here by a different page and thought I may as well check things out. I like what I see so now i'm following you. Look forward to finding out about your web page for a second time.
    flight tickets2020-07-31 09:36 回复 Linux | Firefox浏览器 2.0.0.2
  10. Great post! We will be linking to this particularly great article on our site. Keep up the great writing.
    cheap flights 20202020-07-27 22:02 回复 Linux | Firefox浏览器 60.0.1
  11. Hi there! I just want to offer you a big thumbs up for the great information you've got here on this post. I will be coming back to your web site for more soon.
    best hosting2020-07-27 03:12 回复 Linux | Firefox浏览器 52.9
  12. Thanks on your marvelous posting! I seriously enjoyed reading it, you could be a great author. I will make sure to bookmark your blog and definitely will come back in the future. I want to encourage one to continue your great writing, have a nice holiday weekend!
    web hosting services2020-07-26 06:05 回复 Linux | Chrome 66.0.3359.181
  13. Greate post. Keep writing such kind of information on your site. Im really impressed by your site. Hello there, You have done an excellent job. I will certainly digg it and individually recommend to my friends. I'm confident they'll be benefited from this web site.
    website hosting2020-07-25 12:25 回复 Linux | Firefox浏览器 52.9
  14. I know this web page offers quality dependent articles or reviews and extra information, is there any other web site which offers such things in quality?
    best web hosting 20202020-07-23 11:36 回复 Linux | Chrome 66.0.3359.181
  15. If you want to obtain a good deal from this piece of writing then you have to apply these strategies to your won website.
    hosting services2020-07-22 05:19 回复 Linux | Chrome 67.0.3372.0
  16. You actually make it seem so easy with your presentation however I to find this matter to be actually something that I believe I'd never understand. It seems too complex and very vast for me. I am looking ahead in your next publish, I'll try to get the grasp of it!
    website hosting companies2020-07-18 10:53 回复 Linux | Chrome 66.0.3359.139
  17. Good post. I learn something totally new and challenging on blogs I stumbleupon everyday. It's always interesting to read content from other authors and use a little something from their web sites.
    content hosting2020-07-16 21:04 回复 Linux | Chrome 66.0.3359.139
  18. I do believe all the ideas you've offered to your post. They are really convincing and can certainly work. Still, the posts are very quick for novices. May you please lengthen them a little from next time? Thanks for the post.
    cbd oil that works 20202020-06-27 20:25 回复 Windows 8.1 | Chrome 66.0.3359.181
  19. Definitely believe that which you stated. Your favorite reason appeared to be on the web the simplest thing to be aware of. I say to you, I definitely get irked while people consider worries that they plainly do not know about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people can take a signal. Will probably be back to get more. Thanks
    tinyurl.com2020-06-27 06:56 回复 Linux | Chrome 66.0.3359.117
  20. Excellent site. Plenty of helpful info here. I am sending it to a few pals ans also sharing in delicious. And obviously, thank you on your effort!
    g rsacwgxy2020-06-23 02:48 回复 Linux | Chrome 65.0.3325.109