You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Galaxy/src/12306/inter/LiftTicketInit.py

25 lines
664 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# coding=utf-8
import re
class liftTicketInit:
def __init__(self, session):
self.session = session
def reqLiftTicketInit(self):
"""
请求抢票页面
:return:
"""
urls = self.session.urls["left_ticket_init"]
# 获取初始化的结果
result = self.session.httpClint.send(urls)
# 用正则表达式查出CLeftTicketUrl的值
matchObj = re.search('var CLeftTicketUrl = \'(.*)\'', result, re.M|re.I);
if matchObj:
# 如果有值替换queryUrl
self.session.queryUrl = matchObj.group(1)
return {
"status": True
}