diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2022-11-16 13:37:55 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2022-11-16 14:01:40 +0100 |
commit | e16d9c087976fde03a885edac501991ffa8e00b8 (patch) | |
tree | 7ab1fd19c8428e7874365cda9a71fc585c87bafb | |
parent | 4bc653217f44221306a907fcce917477e931a8e6 (diff) | |
download | osm_where-e16d9c087976fde03a885edac501991ffa8e00b8.tar.gz |
Cache to the subdirectory of the standard XDG Caching tree.0.1.0
Fixes: https://todo.sr.ht/~mcepl/osm_where/1
-rw-r--r-- | pyproject.toml | 1 | ||||
-rwxr-xr-x | src/osm_where.py | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/pyproject.toml b/pyproject.toml index 7b190cb..c63ec7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ license = { file="LICENSE" } readme = "README.md" dependencies = [ "OSMPythonTools", + "pyxdg", ] classifiers = [ "Programming Language :: Python :: 3", diff --git a/src/osm_where.py b/src/osm_where.py index e0b7022..52e7b9b 100755 --- a/src/osm_where.py +++ b/src/osm_where.py @@ -1,7 +1,13 @@ #!/usr/bin/env python3 import argparse + +import xdg.BaseDirectory + +from OSMPythonTools.cachingStrategy import CachingStrategy, JSON from OSMPythonTools.overpass import Overpass +CachingStrategy.use(JSON, cacheDir=xdg.BaseDirectory.save_cache_path('osm_where')) + import logging logging.getLogger("OSMPythonTools").setLevel(logging.ERROR) |