-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.py
64 lines (54 loc) · 1.97 KB
/
hello.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
import subprocess
from concurrent.futures import ThreadPoolExecutor
def run_curl_commands(email):
# curl -X POST http://localhost:5000/user@example.com
subprocess.run(["curl", "-X", "POST", f"http://localhost:5000/{email}"])
# curl -X POST -H "Content-Type: application/json" -d '{"id": 0}' http://localhost:5000/user@example.com/add_to_cart
subprocess.run(
[
"curl",
"-X",
"POST",
"-H",
"Content-Type: application/json",
"-d",
'{"id": 0}',
f"http://localhost:5000/{email}/add_to_cart",
]
)
# curl -X POST -H "Content-Type: application/json" -d '{"id": 1}' http://localhost:5000/user@example.com/add_to_cart
subprocess.run(
[
"curl",
"-X",
"POST",
"-H",
"Content-Type: application/json",
"-d",
'{"id": 1}',
f"http://localhost:5000/{email}/add_to_cart",
]
)
# curl -X GET http://localhost:5000/user@example.com/cart
subprocess.run(["curl", "-X", "GET", f"http://localhost:5000/{email}/cart"])
# curl -X DELETE -H "Content-Type: application/json" -d '{"id": 1}' http://localhost:5000/user@example.com/remove_from_cart
subprocess.run(
[
"curl",
"-X",
"DELETE",
"-H",
"Content-Type: application/json",
"-d",
'{"id": 1}',
f"http://localhost:5000/{email}/remove_from_cart",
]
)
# curl -X GET http://localhost:5000/user@example.com/cart
subprocess.run(["curl", "-X", "GET", f"http://localhost:5000/{email}/cart"])
# curl -X POST http://localhost:5000/user@example.com/checkout
subprocess.run(["curl", "-X", "POST", f"http://localhost:5000/{email}/checkout"])
with ThreadPoolExecutor(max_workers=110) as executor:
for i in range(1000):
email = i
executor.submit(run_curl_commands, email)