import mechanize import time from config import register_url class Transaction(object): def __init__(self): pass def run(self): b = mechanize.Browser() b.set_handle_robots(False) start_time = time.time() resp = b.open(register_url) content = resp.read() latency = time.time() - start_time self.custom_timers['Load_Registration_Page'] = latency assert (resp.code == 200), 'Bad Response: HTTP %s' % resp.code return if __name__ == '__main__': trans = Transaction() trans.run() print trans.custom_timers