Skip to content
This repository has been archived by the owner on Feb 10, 2019. It is now read-only.

Commit

Permalink
fix #46
Browse files Browse the repository at this point in the history
  • Loading branch information
septs committed Apr 11, 2016
1 parent dce1cb4 commit 9eb5b0c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions fetch-timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,16 @@ def handle_ipset(ips):
if not delta:
continue
print('\t\t%-15s\t%.3fms' % (ip, delta))
return payload
save_result(payload)


def load_payload(path):
if os.path.exists(path):
with open(path, encoding='UTF-8') as fp:
return json.loads(fp.read())
else:
print('"%s" file not found.' % path)
sys.exit(1)


def save_result(payload):
Expand Down Expand Up @@ -148,13 +151,11 @@ def main():

args = parser.parse_args()

save_result(
fetch(
load_payload(args.payload),
timeout=args.timeout / 1000.0,
concurrent=args.concurrent,
testing_times=args.testing_times
)
fetch(
load_payload(args.payload),
timeout=args.timeout / 1000.0,
concurrent=args.concurrent,
testing_times=args.testing_times
)


Expand Down

0 comments on commit 9eb5b0c

Please sign in to comment.