This PR adds cache_filename parameter to the NWIS Client. This allows a user to specify the location to store cached requests.
closes #175.
Additions
cache_filename parameter added to nwis_client.IVDataService. Allows a user to configure the name and location of the sqlite cache. Default remainsnwisiv_cache.sqlite.cache_filename's that do not include the suffix.sqlitewill have.sqlite` concatenated as their file-type suffix.
Changes
alteration to goal set out in 174. Now, nwis_client > 3.1 will raise RuntimeError exception instead of RuntimeWarning when arguments in **params case insensitively match a non-**params argument. (i.e. service.get(startdt="2022-01-01", ...) the correct call is service.get(startDT="2022-01-01", ...)). Previously, the proposed warning to error timeline was nwis_client > 3.0.
Testing
Unit / integration tests for nwis_client now use temporary cache file. This results in test speeds that are slower, but it mitigates potentially strange behavior that might result from unit tests sharing a cache.
Notes
In the future, I might add the ability to pass a hydrotools._restclient.RestClient instance to the IVDataService constructor. it might be nice to have dependency injection when we are to expand to other nwis REST services (i.e. daily value service).
Checklist
[x] PR has an informative and human-readable title
[x] PR is well outlined and documented. See #12 for an example
[x] Changes are limited to a single goal (no scope creep)
[x] Code can be automatically merged (no conflicts)
This PR adds
cache_filename
parameter to the NWIS Client. This allows a user to specify the location to store cached requests.closes #175.
Additions
cache_filename
parameter added tonwis_client.IVDataService. Allows a user to configure the name and location of the sqlite cache. Default remains
nwisiv_cache.sqlite.
cache_filename's that do not include the suffix
.sqlitewill have
.sqlite` concatenated as their file-type suffix.Changes
nwis_client
> 3.1 will raiseRuntimeError
exception instead ofRuntimeWarning
when arguments in**params
case insensitively match a non-**params
argument. (i.e.service.get(startdt="2022-01-01", ...)
the correct call isservice.get(startDT="2022-01-01", ...)
). Previously, the proposed warning to error timeline wasnwis_client
> 3.0.Testing
nwis_client
now use temporary cache file. This results in test speeds that are slower, but it mitigates potentially strange behavior that might result from unit tests sharing a cache.Notes
hydrotools._restclient.RestClient
instance to theIVDataService
constructor. it might be nice to have dependency injection when we are to expand to othernwis
REST services (i.e. daily value service).Checklist