Skip to content

Commit

Permalink
fix: use old hitchmap dump is new one is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
tillwenke committed Jan 25, 2025
1 parent d60b557 commit d2fa02b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions heatchmap/gpmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,17 @@ def __init__(self, region="world", resolution=10, version="prod", visual:bool=Fa
os.makedirs(f"{self.cache_dir}/hitchmap", exist_ok=True)
self.points_path = f"{HERE}/cache/hitchmap/dump.sqlite"
hitchmap_url = 'https://hitchmap.com/dump.sqlite'
response = requests.get(hitchmap_url)
response.raise_for_status() # Check for HTTP request errors
with open(self.points_path, "wb") as file:
file.write(response.content)
logger.info(f"Downloaded Hitchmap data to: {self.points_path}")
try:
response = requests.get(hitchmap_url)
response.raise_for_status() # Check for HTTP request errors
with open(self.points_path, "wb") as file:
file.write(response.content)
logger.info(f"Downloaded Hitchmap data to: {self.points_path}")
except Exception as e:
logger.info(f"Failed to download Hitchmap data with {e}. Might be that on older version is still available.")

if not os.path.isfile(self.points_path()):
raise FileNotFoundError(f"No Hitchmap data found at {self.points_path}.")

if os.path.exists("models/kernel.pkl"):
self.gpr_path = "models/kernel.pkl"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import setuptools

VERSION = "0.1.29"
VERSION = "0.1.30"

NAME = "heatchmap"

Expand Down

0 comments on commit d2fa02b

Please sign in to comment.