| OLD | NEW |
| 1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import base64 | 5 import base64 |
| 6 import functools | |
| 7 import httplib | 6 import httplib |
| 8 import json | 7 import json |
| 9 import logging | 8 import logging |
| 10 import os | 9 import os |
| 11 import shutil | 10 import shutil |
| 12 import sys | 11 import sys |
| 13 import tarfile | 12 import tarfile |
| 14 import tempfile | 13 import tempfile |
| 15 import time | |
| 16 | 14 |
| 17 # Add third party paths. | 15 # Add third party paths. |
| 18 from . import env | 16 from . import env |
| 19 from . import requests_ssl | 17 from . import requests_ssl |
| 20 from . import util | 18 from . import util |
| 21 from .requests_ssl import requests | 19 from .requests_ssl import requests |
| 22 | 20 |
| 23 import subprocess42 | 21 import subprocess42 |
| 24 from google.protobuf import text_format | 22 from google.protobuf import text_format |
| 25 | 23 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 logging.info('fetching %s', url) | 331 logging.info('fetching %s', url) |
| 334 | 332 |
| 335 resp = requests.get(url) | 333 resp = requests.get(url) |
| 336 if resp.status_code != httplib.OK: | 334 if resp.status_code != httplib.OK: |
| 337 raise GitilesFetchError(resp.status_code, resp.text) | 335 raise GitilesFetchError(resp.status_code, resp.text) |
| 338 | 336 |
| 339 if not resp.text.startswith(cls._GERRIT_XSRF_HEADER): | 337 if not resp.text.startswith(cls._GERRIT_XSRF_HEADER): |
| 340 raise GitilesFetchError(resp.status_code, 'Missing XSRF header') | 338 raise GitilesFetchError(resp.status_code, 'Missing XSRF header') |
| 341 | 339 |
| 342 return json.loads(resp.text[len(cls._GERRIT_XSRF_HEADER):]) | 340 return json.loads(resp.text[len(cls._GERRIT_XSRF_HEADER):]) |
| OLD | NEW |