-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
executable file
·28 lines (23 loc) · 865 Bytes
/
cli.py
File metadata and controls
executable file
·28 lines (23 loc) · 865 Bytes
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
import grequests
import sys, datetime
def main(*args):
urls = [
'http://localhost:8000/test?timeout=10&name=req1',
'http://localhost:8001/test?timeout=9&name=req2',
'http://localhost:8002/test?timeout=8&name=req3',
'http://localhost:8003/test?timeout=7&name=req4',
'http://localhost:8004/test?timeout=6&name=req5',
'http://localhost:8004/test?timeout=5&name=req6',
'http://localhost:8003/test?timeout=4&name=req7',
'http://localhost:8002/test?timeout=3&name=req8',
'http://localhost:8001/test?timeout=2&name=req9',
'http://localhost:8000/test?timeout=1&name=req0',
]
print datetime.datetime.now()
rs = (grequests.get(u) for u in urls)
for res in grequests.imap(rs, size=10):
print datetime.datetime.now()
print res.text
print datetime.datetime.now()
if __name__ == '__main__':
main(*sys.argv[1:])