| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Gerrit functions for GAE environment.""" | 5 """Gerrit functions for GAE environment.""" |
| 6 | 6 |
| 7 import collections | 7 import collections |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 import urllib | 10 import urllib |
| 11 import urlparse | 11 import urlparse |
| 12 | 12 |
| 13 from google.appengine.ext import ndb | 13 from google.appengine.ext import ndb |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 msg = ( | 187 msg = ( |
| 188 'Unexpected response format. Expected prefix %s. Received: %s' % | 188 'Unexpected response format. Expected prefix %s. Received: %s' % |
| 189 (RESPONSE_PREFIX, content)) | 189 (RESPONSE_PREFIX, content)) |
| 190 raise net.Error(msg, status_code=200, response=content) | 190 raise net.Error(msg, status_code=200, response=content) |
| 191 raise ndb.Return(json.loads(content[len(RESPONSE_PREFIX):])) | 191 raise ndb.Return(json.loads(content[len(RESPONSE_PREFIX):])) |
| 192 | 192 |
| 193 | 193 |
| 194 def fetch_json(*args, **kwargs): | 194 def fetch_json(*args, **kwargs): |
| 195 """Blocking version of fetch_json_async.""" | 195 """Blocking version of fetch_json_async.""" |
| 196 return fetch_json_async(*args, **kwargs).get_result() | 196 return fetch_json_async(*args, **kwargs).get_result() |
| OLD | NEW |