-
Notifications
You must be signed in to change notification settings - Fork 6
/
call.py
76 lines (69 loc) · 2.23 KB
/
call.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# coding=utf-8
import requests
import os
from config import *
header = {
'Accept':'*/*',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'en,zh-CN;q=0.8,zh;q=0.6,zh-TW;q=0.4',
'Connection':'keep-alive',
'Content-Length':'32',
'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8',
'Cookie':cookie,
'Host':'m.01zhuanche.com',
'Origin':'http://m.01zhuanche.com',
'Referer':'http://m.01zhuanche.com/touch/h5Home/wxpub/n_jishi',
#'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3',
'X-Requested-With':'XMLHttpRequest'
}
book_data = {
'bookingDate':curr_time,
'bookingStartPointLo':StartPointLo,
'bookingStartPointLa':StartPointLa,
'bookingEndPointLo':EndPointLo,
'bookingEndPointLa':EndPointLa,
'bookingStartAddr':StartAddr,
'bookingEndAddr':EndAddr,
'groupIds':'34',
'estimatedAmount':'53',
'channel':'wxpub'
}
for i in range(1, 200):
try:
r = requests.post('http://m.01zhuanche.com/touch/order/bookingCar', headers=header, data=book_data).json()
except:
print 'cookie过期,请重新获取'
break
#print r['errmsg']
print r
if r['data']['returnCode'] == '0':
print 'Order success! pooling...'
print 'Order time:'
print time.localtime(float(curr_time))
cancel_data={
'orderNo':r['data']['orderNo'],
'orderId':r['data']['orderId'],
'cancelType':'11'
}
pool_data = {
'orderNo':r['data']['orderNo'],
'channel':'wxpub'
}
for j in range(1, 41):
r = requests.post('http://m.01zhuanche.com/touch/order/pollingOrder', headers=header, data=pool_data).json()
print r
if r['data']['returnCode'] == '0':
print 'success'
car_number = r['data']['order']['licensePlates']
driver_phone = r['data']['order']['phone']
driver_name = r['data']['order']['driverName']
color = r['data']['order']['color']
print car_number
print driver_phone
print driver_name
print color
os._exit(0)
print j, 'no car, pooling...'
time.sleep(5)
requests.post('http://m.01zhuanche.com/touch/order/cancelOrderBeforeAccepted', headers=header, data=cancel_data).json()