Skip to content

Instantly share code, notes, and snippets.

@belminf
Created March 28, 2016 21:53
Show Gist options
  • Save belminf/f4843cbb138e85bb305e to your computer and use it in GitHub Desktop.
Save belminf/f4843cbb138e85bb305e to your computer and use it in GitHub Desktop.
Tests timeouts for HTTPS connections
#!/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