-
Notifications
You must be signed in to change notification settings - Fork 14
/
query_travel_left_parallel.py
55 lines (44 loc) · 1.86 KB
/
query_travel_left_parallel.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
from atomic_queries import _query_high_speed_ticket, _query_normal_ticket, _query_high_speed_ticket_parallel
from utils import random_boolean
import logging
import time
logger = logging.getLogger("query_and_preserve")
# The UUID of user fdse_microservice is that
uuid = "4d2a46c7-71cb-4cf1-b5bb-b68406d9da6f"
date = time.strftime("%Y-%m-%d", time.localtime())
base_address = "http://139.196.152.44:31000"
def query_travel_left_parallel(headers):
"""
1. 查票(随机高铁或普通)
2. 查保险、Food、Contacts
3. 随机选择Contacts、保险、是否买食物、是否托运
4. 买票
:return:
"""
start = ""
end = ""
trip_ids = []
PRESERVE_URL = ""
start = "Su Zhou"
end = "Shang Hai"
high_speed_place_pair = (start, end)
trip_ids = _query_high_speed_ticket_parallel(place_pair=high_speed_place_pair, headers=headers, time=date)
if __name__ == '__main__':
cookie = "JSESSIONID=823B2652E3F5B64A1C94C924A05D80AF; YsbCaptcha=2E037F4AB09D49FA9EE3BE4E737EAFD2"
Authorization = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJmZHNlX21pY3Jvc2VydmljZSIsInJvbGVzIjpbIlJPTEVfVVNFUiJdLCJpZCI6IjRkMmE0NmM3LTcxY2ItNGNmMS1iNWJiLWI2ODQwNmQ5ZGE2ZiIsImlhdCI6MTYyOTM2ODk1NiwiZXhwIjoxNjI5MzcyNTU2fQ.K206pVlC2JgeATGYjQksPJt3DUNsfbVH4pgx9b54zwg"
headers = {
'Connection': 'close',
"Cookie": f"{cookie}",
"Authorization": f"Bearer {Authorization}",
"Content-Type": "application/json"
}
start_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
print(f"start:{start_time}")
for i in range(320):
try:
query_travel_left_parallel(headers=headers)
print("*****************************INDEX:" + str(i))
except Exception as e:
print(e)
end_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
print(f"start:{start_time} end:{end_time}")