Created
March 28, 2016 21:53
-
-
Save belminf/f4843cbb138e85bb305e to your computer and use it in GitHub Desktop.
Tests timeouts for HTTPS connections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Example run: | |
# time ./test_https_timeout.py example.com 200 10 | |
import httplib | |
import sys | |
from time import sleep | |
c = httplib.HTTPSConnection(sys.argv[1]) | |
sleep_secs = int(sys.argv[2]) | |
sleep_inc = int(sys.argv[3]) | |
while True: | |
c.request('GET', '/') | |
response = c.getresponse() | |
response.read() | |
print(response.status, response.reason) | |
print('Sleeping for {} seconds'.format(sleep_secs)) | |
sleep(sleep_secs) | |
sleep_secs += sleep_inc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment