1. Project address
https://github.com/testerSunshine/12306
Here I only write their own build process, there is another way, you can see directly on the github
2. Install python3.7.4
This stuff is not got from the official website, slow batch. Here is what I find online Baidu cloud address.
Links: https://pan.baidu.com/s/1fMfTpj2vywtXtyYVgzS7Ug
Extraction code: hcaa
Once you have downloaded can be installed directly.
3. build cloud coding
Project Address: https://github.com/YinAoXiong/12306_code_server
This got me I was directly mirrored by docker run directly on the server, the student discount.
拉取:docker pull yinaoxiong/12306_code_server
运行:docker run -d -p 8088:80 --name 12306 yinaoxiong/12306_code_server
In the browser enter the ip: port, to see hello world, it means get
4. Pull project source code
Got me through git clone directly to the local can.
Then it is to modify the configuration file: TickerConfig.py, file very close to a lot of notes.
Here I will simply write a little problem I encountered.
4.1.HOST
Here we can use our just run up mirror, of course, if you do not, you can also use the service he provides.
If the building is through the docker, you will need to be changed: captcha: 80
4.2.EMAIL_CONF
Mailbox configuration is mainly used to send notification messages, I use a 139 mailbox, SMS notification can be done.
139 E-mail sending server is: stmp.139.com
4.3.SERVER_CHAN_CONF
This is achieved by micro letter public notice number, I do not have to configure. Want to configure can see github, it provides a tutorial.
4.4.COOKIE_TYPE
The 12306 is to obtain login credentials. It provides three ways.
1. selenium get devicesID
This means that by ChromeDriver, to acquire credentials to automatically log 12306.
You need to configure CHROME_PATH = "", path is the path of your download ChromeDriver
ChromeDriver download the following address: https://chromedriver.storage.googleapis.com/index.html
Select the Chrome browser to download the corresponding version, you can download, unzip.
It requires the specific path configuration file: CHROME_PATH = "U: \\ ChromeDriver \\ chromedriver_win32 \\ chromedriver.exe"
I configured this time, it seems impossible to control Chrome, then give up. But you can try.
2. Use the web client / otn / HttpZF / logdevice get devicesId
This algorithm interface may currently be a problem, if the login configuration has been changed to 1 302, please.
I configured the next, is really 302, then give up.
3. open a browser window and crawled RAIL_DEVICEID RAIL_EXPIRATION in headers-Cookies, this would not have to configure selenium
Open your browser and enter the 12306 official website, open the debug mode, Firefox is F12, select Network.
In the 12306 official website, enter the account name and password, to log on.
Click on the last request, select Cookie, these two fields we are looking for the data.
Copy down, to fill in the following configuration.
RAIL_EXPIRATION = " "
RAIL_DEVICEID = " "
5. Run the project
5.1. Installation depends
In the folder of the project, Shift + Right in here to open a command window open, install dependencies.
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
5.2. Test
python run.py t
The test is successful, you will be able to receive the test message.
5.3. Screening CDN
python run.py c
5.4. Run to grab votes
python run.py r
6. Dependence
At runtime, probably because it relies original run. Generally given as follows:
ModuleNotFoundError: No module named "XXXX"
This time only the modules you want to install it on the line
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple XXXX
Very few of the names do not match, direct Baidu just fine.
And finally: I wish everyone to grab votes.