OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2010 Google Inc. All Rights Reserved. | 2 # Copyright 2010 Google Inc. All Rights Reserved. |
3 # | 3 # |
4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
7 # | 7 # |
8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
9 # | 9 # |
10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 | 51 |
52 class HttpArchiveException(Exception): | 52 class HttpArchiveException(Exception): |
53 """Base class for all exceptions in httparchive.""" | 53 """Base class for all exceptions in httparchive.""" |
54 pass | 54 pass |
55 | 55 |
56 | 56 |
57 class HttpArchive(dict, persistentmixin.PersistentMixin): | 57 class HttpArchive(dict, persistentmixin.PersistentMixin): |
58 """Dict with ArchivedHttpRequest keys and ArchivedHttpResponse values. | 58 """Dict with ArchivedHttpRequest keys and ArchivedHttpResponse values. |
59 | 59 |
60 PersistentMixin adds CreateNew(filename), Load(filename), and Persist(). | 60 PersistentMixin adds the following methods: |
| 61 AssertWritable(filename) |
| 62 Load(filename) |
| 63 Persist(filename) |
61 | 64 |
62 Attributes: | 65 Attributes: |
63 server_rtt: dict of {hostname, server rtt in milliseconds} | 66 server_rtt: dict of {hostname, server rtt in milliseconds} |
64 """ | 67 """ |
65 | 68 |
66 def __init__(self): | 69 def __init__(self): |
67 self.server_rtt = {} | 70 self.server_rtt = {} |
68 | 71 |
69 def get_server_rtt(self, server): | 72 def get_server_rtt(self, server): |
70 """Retrieves the round trip time (rtt) to the server | 73 """Retrieves the round trip time (rtt) to the server |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 elif command == 'edit': | 734 elif command == 'edit': |
732 http_archive.edit(options.command, options.host, options.path) | 735 http_archive.edit(options.command, options.host, options.path) |
733 http_archive.Persist(replay_file) | 736 http_archive.Persist(replay_file) |
734 else: | 737 else: |
735 option_parser.error('Unknown command "%s"' % command) | 738 option_parser.error('Unknown command "%s"' % command) |
736 return 0 | 739 return 0 |
737 | 740 |
738 | 741 |
739 if __name__ == '__main__': | 742 if __name__ == '__main__': |
740 sys.exit(main()) | 743 sys.exit(main()) |
OLD | NEW |