[Note: Just learn open source code, do not use it to make money, this thing can really make money, all business consequences are at your own risk! 】
Distributed, multi-account, multi-task ticket purchasing
Features
-
Check remaining tickets on multiple dates
-
Automatically code and place orders
-
User status recovery
-
Phone voice notification
-
Multi-account, multi-tasking, multi-thread support
-
Single task multi-site query
-
Distributed operation
-
Docker support
-
Dynamically modify configuration files
-
E-mail notification
-
Web management page
-
WeChat message notification
-
Proxy pool support (pyproxy-async)
use
py12306 needs to run on python 3.6 or above (other versions have not been tested yet)
1. Install dependencies
git clone https://github.com/pjialin/py12306 pip install -r requirements.txt
2. Configuration program
cp env.py.example env.py
Automatic coding
(If the service has been stopped, free coding mode can only be set at present) free has been connected to the coding sharing platform, https://py12306-helper.pjialin.com, welcome to participate and share
Voice notification
The voice verification code uses a service provider in the Alibaba Cloud API market. You need to go to https://market.aliyun.com/products/56928004/cmapi026600.html and fill in the appcode into the configuration after purchase.
3. Pre-launch testing
Currently, some simple tests are provided, including user account detection, passenger information detection, station detection, etc.
Start testing -t
python main.py -t
Test notification message (voice, email) -t -n
# Notification testing will not be performed by default. To test notifications, you need to add the -n parameter. python main.py -t -n
4. Run the program
python main.py
parameter list
-
-t test configuration information
-
-t -n test configuration information and notification messages
-
-c specifies the location of the custom configuration file
Distributed cluster
The cluster depends on redis, current support status
-
A single master node and multiple sub-nodes run simultaneously
-
After the master node goes down, it automatically switches and promotes the child node to the master node.
-
After the master node is restored, it will automatically restore to the real master node.
-
Configuration is synchronized to all child nodes through the master node
-
There is no need to restart the child nodes after the master node configuration is modified, and automatic updates are supported.
-
Sub-node messages are synchronized to the master node in real time
use
CLUSTER_ENABLED
Open the configuration file to enable distributed
Currently a separate sub-node configuration file is provided. env.slave.py.example
Modify the file to , you can quickly start env.slave.py
by passingpython main.py -c env.slave.py
Docker use
1. Download the configuration file to local
docker run --rm pjialin/py12306 cat /config/env.py > env.py # or curl https://raw.githubusercontent.com/pjialin/py12306/master/env.docker.py.example -o env.py
2. Run after modifying the configuration
docker run --rm --name py12306 -p 8008:8008 -d -v $(pwd):/config -v py12306:/data pjialin/py12306
There will be an additional log file 12306.log in the current directory. tail -f 12306.log
Used in Docker-compose
1. Copy configuration file
cp docker-compose.yml.example docker-compose.yml
2. Run from docker-compose
docker-compose.yml
Use the command in the directory where you are located
docker-compose up -d
Web management page
Currently, users, tasks and real-time log viewing are supported, and more functions will be added in the future.
use
To turn on the Web function, you need to turn it on in the configuration WEB_ENABLE
. After starting the program, access the current host address + port number (default 8008), such as http://127.0.0.1:8008
renew
-
19-01-10
-
Support distributed clusters
-
-
19-01-11
-
Configuration files support dynamic modification
-
-
19-01-12
-
Added free coding
-
-
19-01-14
-
Added web page support
-
-
19-01-15
-
Add DingTalk notification
-
Added Telegram notification
-
Added ServerChan and PushBear WeChat push
-
-
19-01-18
-
Add CDN query
-
screenshot
Web management page
successfully ordered
About anti-sealing
Currently, query and login operations are separated. Query does not depend on whether the user is logged in. It is easy to restrict the IP address when placed in A cloud or T cloud. It is recommended to run in other network environments.
www.github.top
Sharing of the top projects on GitHub
The most popular Python open source projects
Domestic mirror: http://www.gitpp.com:8099/tomsonberg/python12306