Skip to content

Instantly share code, notes, and snippets.

@richleland
Created February 7, 2012 14:57
Show Gist options
  • Select an option

  • Save richleland/1760085 to your computer and use it in GitHub Desktop.

Select an option

Save richleland/1760085 to your computer and use it in GitHub Desktop.
import time
import requests
class Transaction(object):
def __init__(self):
self.custom_timers = {}
self.base_url = 'http://www.treehugger.com'
self.headers = {}
def run(self):
start = time.time()
r = requests.get(self.base_url + '/', headers=self.headers)
latency = time.time() - start
self.custom_timers['Home_Page'] = latency
assert (r.status_code == requests.codes.ok), 'Bad HTTP Response'
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment