We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3be27a commit 3ebce51Copy full SHA for 3ebce51
astroquery/query.py
@@ -15,6 +15,7 @@
15
import textwrap
16
17
from datetime import datetime, timedelta
18
+from pathlib import Path
19
20
from astropy.config import paths
21
from astroquery import log
@@ -31,10 +32,14 @@
31
32
33
def to_cache(response, cache_file):
34
log.debug("Caching data to {0}".format(cache_file))
35
+
36
response = copy.deepcopy(response)
37
if hasattr(response, 'request'):
38
for key in tuple(response.request.hooks.keys()):
39
del response.request.hooks[key]
40
41
+ chache_dir, _ = os.path.split(cache_file)
42
+ Path(chache_dir).mkdir(parents=True, exist_ok=True)
43
with open(cache_file, "wb") as f:
44
pickle.dump(response, f)
45
0 commit comments