From d420a7ced989eeca16f86157175fb884228e6a3b Mon Sep 17 00:00:00 2001 From: "Charles Graham, SWT" Date: Mon, 29 Sep 2025 22:46:37 -0500 Subject: [PATCH] Add missing param/kwarg to store_location --- cwms/locations/physical_locations.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cwms/locations/physical_locations.py b/cwms/locations/physical_locations.py index 39ad66f0..d703dad6 100644 --- a/cwms/locations/physical_locations.py +++ b/cwms/locations/physical_locations.py @@ -128,7 +128,7 @@ def delete_location( return api.delete(endpoint, params=params) -def store_location(data: JSON) -> None: +def store_location(data: JSON, fail_if_exists: bool = True) -> None: """ This method is used to store and update location's data through CWMS Data API. @@ -137,6 +137,10 @@ def store_location(data: JSON) -> None: data : dict A dictionary representing the JSON data to be stored. If the `data` value is None, a `ValueError` will be raised. + fail_if_exists : bool, optional + A boolean value indicating whether to fail if the outlet already exists. + Default is True. + Returns ------- @@ -148,8 +152,8 @@ def store_location(data: JSON) -> None: raise ValueError("Storing location requires a JSON data dictionary") endpoint = "locations" - - return api.post(endpoint, data) + params = {"fail-if-exists": fail_if_exists} + return api.post(endpoint, data, params=params) def update_location(location_id: str, data: JSON) -> None: