| OLD | NEW |
| 1 # Copyright 2014 Google Inc. All Rights Reserved. | 1 # Copyright 2014 Google Inc. All Rights Reserved. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 from __future__ import division | 23 from __future__ import division |
| 24 | 24 |
| 25 import datetime | 25 import datetime |
| 26 import json | 26 import json |
| 27 import logging | 27 import logging |
| 28 import os | 28 import os |
| 29 import tempfile | 29 import tempfile |
| 30 import threading | 30 import threading |
| 31 | 31 |
| 32 from oauth2client.locked_file import LockedFile | 32 from oauth2client.contrib.locked_file import LockedFile |
| 33 | 33 |
| 34 from . import base | 34 from . import base |
| 35 from ..discovery_cache import DISCOVERY_DOC_MAX_AGE | 35 from ..discovery_cache import DISCOVERY_DOC_MAX_AGE |
| 36 | 36 |
| 37 logger = logging.getLogger(__name__) | 37 logger = logging.getLogger(__name__) |
| 38 | 38 |
| 39 FILENAME = 'google-api-python-client-discovery-doc.cache' | 39 FILENAME = 'google-api-python-client-discovery-doc.cache' |
| 40 EPOCH = datetime.datetime.utcfromtimestamp(0) | 40 EPOCH = datetime.datetime.utcfromtimestamp(0) |
| 41 | 41 |
| 42 | 42 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 json.dump(cache, f.file_handle()) | 123 json.dump(cache, f.file_handle()) |
| 124 else: | 124 else: |
| 125 logger.debug('Could not obtain a lock for the cache file.') | 125 logger.debug('Could not obtain a lock for the cache file.') |
| 126 except Exception as e: | 126 except Exception as e: |
| 127 logger.warning(e, exc_info=True) | 127 logger.warning(e, exc_info=True) |
| 128 finally: | 128 finally: |
| 129 f.unlock_and_close() | 129 f.unlock_and_close() |
| 130 | 130 |
| 131 | 131 |
| 132 cache = Cache(max_age=DISCOVERY_DOC_MAX_AGE) | 132 cache = Cache(max_age=DISCOVERY_DOC_MAX_AGE) |
| OLD | NEW |