Skip to content

Commit

Permalink
optional dst_dir in CWSRecorder with default in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
martibosch committed Feb 14, 2022
1 parent e291f0b commit 149a023
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions netatmo_geopy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ def __init__(
lat_sw,
lon_ne,
lat_ne,
dst_dir,
*,
dst_dir=None,
client_id=None,
client_secret=None,
username=None,
Expand All @@ -298,8 +298,10 @@ def __init__(
----------
lon_sw, lat_sw, lon_ne, lat_ne : numeric
Latitude/longitude coordinates of the bounds of the region of interest
dst_dir : str or pathlib.Path object
Path to the directory where the recorded snapshots are to be dumped.
dst_dir : str or pathlib.Path object, optional
Path to the directory where the recorded snapshots are to be dumped. Only
used when the `dump_snapshot_gdf` method is called, ignored otherwise. If
None, the default value from `settings.DEAFULT_DST_DIR`.
client_id, client_secret, username, password : str, optional
Authentication credentials for Netatmo. If None, the respective values set
in the "NETATMO_CLIENT_ID", "NETATMO_CLIENT_SECRET", "NETATMO_USERNAME" and
Expand Down
1 change: 1 addition & 0 deletions netatmo_geopy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
PUBLIC_DATA_URL = f"{BASE_URL}/api/getpublicdata"

# recording/IO
DEFAULT_DST_DIR = "./snapshot-data"
DEFAULT_DATETIME_FORMAT = "%Y-%m-%dT%H:%M"
DEFAULT_SNAPSHOT_FILE_EXT = "gpkg"
DEFAULT_SAVE_RESPONSES = False
Expand Down
5 changes: 3 additions & 2 deletions tests/test_netatmo_geopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import logging as lg
import time

import netatmo_geopy as nat
import numpy as np
import pytest

import netatmo_geopy as nat
from netatmo_geopy import settings, utils


Expand All @@ -34,7 +35,7 @@ def test_core(requests_mock, datadir, shared_datadir, mock_auth):
2,
3,
4,
datadir,
dst_dir=datadir,
client_id="abcd",
client_secret="abcd",
username="john",
Expand Down

0 comments on commit 149a023

Please sign in to comment.