-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbench_azure.py
More file actions
executable file
·37 lines (29 loc) · 886 Bytes
/
bench_azure.py
File metadata and controls
executable file
·37 lines (29 loc) · 886 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
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time,urllib2,re,random
from termcolor import colored
azure_sites_file = './azure_sites.txt'
failed_log = './azure_failed.txt'
TEST_URL = 'https://%s.azurewebsites.net/-proxite-/status?r=%s'
TEST_URL = 'https://%s.azurewebsites.net/?r=%s'
def main():
azure_sites = re.split('\\s+',open(azure_sites_file).read().strip())
results = []
error_sites = []
for domain in azure_sites:
start = time.time()
f = urllib2.urlopen(TEST_URL % (domain,random.random()))
f.read()
t = time.time() - start
code = f.getcode()
if code==200:
color = 'green'
else:
color = 'red'
error_sites.append(domain)
print colored("%10s:%4ds,Status:%d" % (domain,t,code),color)
with open(failed_log,'wb') as f:
f.write(" ".join(error_sites))
f.write("\n")
if __name__ == '__main__':
main()