python查看网站的RTT

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"

posted @ 2015-11-15 21:05  likeshu  阅读(352)  评论(0编辑  收藏  举报