Line | |
---|
1 | import mechanize |
---|
2 | import time |
---|
3 | from config import register_url, register_url2 |
---|
4 | |
---|
5 | class Transaction(object): |
---|
6 | def __init__(self): |
---|
7 | pass |
---|
8 | |
---|
9 | def run(self): |
---|
10 | b = mechanize.Browser() |
---|
11 | b.set_handle_robots(False) |
---|
12 | start_time = time.time() |
---|
13 | resp = b.open(register_url2) |
---|
14 | content = resp.read() |
---|
15 | latency = time.time() - start_time |
---|
16 | self.custom_timers['Load_Registration_Page'] = latency |
---|
17 | assert (resp.code == 200), 'Bad Response: HTTP %s' % resp.code |
---|
18 | return |
---|
19 | |
---|
20 | if __name__ == '__main__': |
---|
21 | trans = Transaction() |
---|
22 | trans.run() |
---|
23 | print trans.custom_timers |
---|
Note: See
TracBrowser for help on using the repository browser.