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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
168 self._reason = args["Error"] | |
168 self.info = args.get("Info", None) | 169 self.info = args.get("Info", None) |
169 | 170 |
171 @property | |
172 def reason(self): | |
173 return self._reason | |
M-A Ruel
2012/09/03 17:34:25
Taken from patchset 3 on https://codereview.appspo
| |
174 | |
170 | 175 |
171 class AbstractRpcServer(object): | 176 class AbstractRpcServer(object): |
172 """Provides a common interface for a simple RPC server.""" | 177 """Provides a common interface for a simple RPC server.""" |
173 | 178 |
174 def __init__(self, host, auth_function, host_override=None, extra_headers={}, | 179 def __init__(self, host, auth_function, host_override=None, extra_headers={}, |
175 save_cookies=False, account_type=AUTH_ACCOUNT_TYPE): | 180 save_cookies=False, account_type=AUTH_ACCOUNT_TYPE): |
176 """Creates a new HttpRpcServer. | 181 """Creates a new HttpRpcServer. |
177 | 182 |
178 Args: | 183 Args: |
179 host: The host to send requests to. | 184 host: The host to send requests to. |
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2347 os.environ['LC_ALL'] = 'C' | 2352 os.environ['LC_ALL'] = 'C' |
2348 RealMain(sys.argv) | 2353 RealMain(sys.argv) |
2349 except KeyboardInterrupt: | 2354 except KeyboardInterrupt: |
2350 print | 2355 print |
2351 StatusUpdate("Interrupted.") | 2356 StatusUpdate("Interrupted.") |
2352 sys.exit(1) | 2357 sys.exit(1) |
2353 | 2358 |
2354 | 2359 |
2355 if __name__ == "__main__": | 2360 if __name__ == "__main__": |
2356 main() | 2361 main() |
OLD | NEW |