python查看网站的RTT

时间:2024-10-23 17:34:14

import requests

time=0.0

jpserver=['jp1.herejump.com','jp1.herejump.com','jp1.herejump.com']

usserver=['us1.herejump.com','us2.herejump.com','us3.herejump.com','us4.herejump.com','us5.herejump.com']

sgserver=['sg1.herejump.com','sg2.herejump.com']

twserver=['tw1.herejump.com']

hkserver=['uk1.herejump.com']

ukserver=['jp1.herejump.com']

github=['https://github.com',]

def getTime(list):

time=0.0

for i in list:

r = requests.get(i)

time = r.elapsed.total_seconds()+time

return time/4.0

print str(getTime(github))+" s"