Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding: utf-8 | 2 # coding: utf-8 |
| 3 # | 3 # |
| 4 # Copyright 2007 Google Inc. | 4 # Copyright 2007 Google Inc. |
| 5 # | 5 # |
| 6 # Licensed under the Apache License, Version 2.0 (the "License"); | 6 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 # you may not use this file except in compliance with the License. | 7 # you may not use this file except in compliance with the License. |
| 8 # You may obtain a copy of the License at | 8 # You may obtain a copy of the License at |
| 9 # | 9 # |
| 10 # http://www.apache.org/licenses/LICENSE-2.0 | 10 # http://www.apache.org/licenses/LICENSE-2.0 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 """Print an error message to stderr and exit.""" | 157 """Print an error message to stderr and exit.""" |
| 158 print >>sys.stderr, msg | 158 print >>sys.stderr, msg |
| 159 sys.exit(1) | 159 sys.exit(1) |
| 160 | 160 |
| 161 | 161 |
| 162 class ClientLoginError(urllib2.HTTPError): | 162 class ClientLoginError(urllib2.HTTPError): |
| 163 """Raised to indicate there was an error authenticating with ClientLogin.""" | 163 """Raised to indicate there was an error authenticating with ClientLogin.""" |
| 164 | 164 |
| 165 def __init__(self, url, code, msg, headers, args): | 165 def __init__(self, url, code, msg, headers, args): |
| 166 urllib2.HTTPError.__init__(self, url, code, msg, headers, None) | 166 urllib2.HTTPError.__init__(self, url, code, msg, headers, None) |
| 167 self.args = args | 167 self.args = args |
|
M-A Ruel
2012/09/03 15:50:11
I upstreamed this CL at https://codereview.appspot
| |
| 168 self.reason = args["Error"] | |
| 169 self.info = args.get("Info", None) | 168 self.info = args.get("Info", None) |
| 170 | 169 |
| 171 | 170 |
| 172 class AbstractRpcServer(object): | 171 class AbstractRpcServer(object): |
| 173 """Provides a common interface for a simple RPC server.""" | 172 """Provides a common interface for a simple RPC server.""" |
| 174 | 173 |
| 175 def __init__(self, host, auth_function, host_override=None, extra_headers={}, | 174 def __init__(self, host, auth_function, host_override=None, extra_headers={}, |
| 176 save_cookies=False, account_type=AUTH_ACCOUNT_TYPE): | 175 save_cookies=False, account_type=AUTH_ACCOUNT_TYPE): |
| 177 """Creates a new HttpRpcServer. | 176 """Creates a new HttpRpcServer. |
| 178 | 177 |
| (...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2348 os.environ['LC_ALL'] = 'C' | 2347 os.environ['LC_ALL'] = 'C' |
| 2349 RealMain(sys.argv) | 2348 RealMain(sys.argv) |
| 2350 except KeyboardInterrupt: | 2349 except KeyboardInterrupt: |
| 2351 print | 2350 print |
| 2352 StatusUpdate("Interrupted.") | 2351 StatusUpdate("Interrupted.") |
| 2353 sys.exit(1) | 2352 sys.exit(1) |
| 2354 | 2353 |
| 2355 | 2354 |
| 2356 if __name__ == "__main__": | 2355 if __name__ == "__main__": |
| 2357 main() | 2356 main() |
| OLD | NEW |