|
@@ -11,6 +11,7 @@ from entity.OrderInfo import OrderInfo,Contact,Passengers,Segments
|
|
from utils.CallbackOrderUtils import CallbackOrderUtils as call
|
|
from utils.CallbackOrderUtils import CallbackOrderUtils as call
|
|
from query.AkWebQuery import AkWebQuery
|
|
from query.AkWebQuery import AkWebQuery
|
|
from query.AkBigQuery import AkBigQuery
|
|
from query.AkBigQuery import AkBigQuery
|
|
|
|
+from imghdr import test_webp
|
|
urllib3.disable_warnings()
|
|
urllib3.disable_warnings()
|
|
import logging
|
|
import logging
|
|
|
|
|
|
@@ -211,7 +212,7 @@ class OrderServer():
|
|
|
|
|
|
#添加代理IP
|
|
#添加代理IP
|
|
cl = call()
|
|
cl = call()
|
|
- proxyurl = cl.getProxyIP()
|
|
|
|
|
|
+ proxyurl = cl.getProxyFixedIP()
|
|
proxy_handler = {
|
|
proxy_handler = {
|
|
'http': 'http://'+proxyurl,
|
|
'http': 'http://'+proxyurl,
|
|
'https': 'https://'+proxyurl,
|
|
'https': 'https://'+proxyurl,
|
|
@@ -236,32 +237,6 @@ class OrderServer():
|
|
agentHomeUrl = res.url
|
|
agentHomeUrl = res.url
|
|
logging.info(self.salt+res.url)
|
|
logging.info(self.salt+res.url)
|
|
|
|
|
|
- if 'err504' in agentHomeUrl:
|
|
|
|
- proxyurl = cl.getProxyIP()
|
|
|
|
- proxy_handler = {
|
|
|
|
- 'http': 'http://'+proxyurl,
|
|
|
|
- 'https': 'https://'+proxyurl,
|
|
|
|
- }
|
|
|
|
- self.session.proxies = proxy_handler
|
|
|
|
- logging.info(self.salt+'前一个质量不高IP:'+proxyurl)
|
|
|
|
- res = self.session.get("https://www.airasia.com/my/en/login/travel-agent.page")
|
|
|
|
- page = etree.HTML(res.text)
|
|
|
|
- self.logindata['__VIEWSTATE'] = page.xpath("//input[@name='__VIEWSTATE']/@value")[0]
|
|
|
|
- self.__VIEWSTATE = self.logindata['__VIEWSTATE']
|
|
|
|
- logging.info(self.salt+'__VIEWSTATE:'+self.__VIEWSTATE)
|
|
|
|
-
|
|
|
|
- logindata = {
|
|
|
|
- "__EVENTARGUMENT": "",
|
|
|
|
- "__EVENTTARGET": "ControlGroupLoginAgentView$AgentLoginView$LinkButtonLogIn",
|
|
|
|
- "ControlGroupLoginAgentView$AgentLoginView$TextBoxUserID": "CNTRIPTOPK_ADMIN",
|
|
|
|
- "ControlGroupLoginAgentView$AgentLoginView$PasswordFieldPassword": "Tripto123",
|
|
|
|
- "pageToken": "",
|
|
|
|
- "TimeZoneDiff": "480"
|
|
|
|
- }
|
|
|
|
- res = self.session.post("https://booking2.airasia.com/LoginAgent.aspx", data=logindata, verify=False, timeout=60)
|
|
|
|
- agentHomeUrl = res.url
|
|
|
|
- logging.info(self.salt+res.url)
|
|
|
|
-
|
|
|
|
if 'LoginAgent.aspx' in agentHomeUrl:
|
|
if 'LoginAgent.aspx' in agentHomeUrl:
|
|
logging.info(self.salt+'一次,登录失败,再次提交一下')
|
|
logging.info(self.salt+'一次,登录失败,再次提交一下')
|
|
res = self.session.post("https://booking2.airasia.com/LoginAgent.aspx", data=self.logindata, verify=False, timeout=60)
|
|
res = self.session.post("https://booking2.airasia.com/LoginAgent.aspx", data=self.logindata, verify=False, timeout=60)
|
|
@@ -523,11 +498,21 @@ class OrderServer():
|
|
|
|
|
|
if bigfPrice != 0.0:
|
|
if bigfPrice != 0.0:
|
|
#一决雌雄 使用那种方式生单 AGENT_ORDER WEB_ORDER BIG_ORDER
|
|
#一决雌雄 使用那种方式生单 AGENT_ORDER WEB_ORDER BIG_ORDER
|
|
- if (bigfPrice + bigrPrice) < (webfPrice + webrPrice) and (bigfPrice + bigrPrice) < (agfPrice + agrPrice):
|
|
|
|
- #Big价格优势
|
|
|
|
- self.oinfo.modeOrder = 'BIG_ORDER'
|
|
|
|
- logging.info(self.salt+'-----Big价格优势')
|
|
|
|
- return
|
|
|
|
|
|
+ bigp = bigfPrice + bigrPrice
|
|
|
|
+ webp = webfPrice + webrPrice
|
|
|
|
+ agp = agfPrice + agrPrice
|
|
|
|
+ if webp != 0.0:
|
|
|
|
+ if bigp < webp and bigp < webp:
|
|
|
|
+ #Big价格优势
|
|
|
|
+ self.oinfo.modeOrder = 'BIG_ORDER'
|
|
|
|
+ logging.info(self.salt+'-----Big价格优势')
|
|
|
|
+ return
|
|
|
|
+ else:
|
|
|
|
+ if bigp < agp:
|
|
|
|
+ #Big价格优势
|
|
|
|
+ self.oinfo.modeOrder = 'BIG_ORDER'
|
|
|
|
+ logging.info(self.salt+'-----Big价格优势')
|
|
|
|
+ return
|
|
|
|
|
|
self.oinfo.modeOrder = 'AGENT_ORDER'
|
|
self.oinfo.modeOrder = 'AGENT_ORDER'
|
|
#接下来是官网与代理的对决
|
|
#接下来是官网与代理的对决
|