Skip to content

Commit 9e26096

Browse files
committed
will this appease flake8
1 parent 1c56573 commit 9e26096

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ print(f"Found {len(flowlines)} upstream tributaries within 50km")
202202
- **Latest daily values**: Most recent daily statistical summary data
203203
- **Latest instantaneous values**: Most recent high-frequency continuous data
204204
- **Samples data**: Discrete USGS water quality data
205-
- **Instantaneous values** (:alarm_clock: *COMING SOON*): High-frequency continuous data
205+
- **Instantaneous values** (*COMING SOON*): High-frequency continuous data
206206

207207
### Legacy NWIS Services (Deprecated)
208208
- **Daily values (dv)**: Legacy daily statistical data

dataretrieval/waterdata/utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,16 @@ def _error_body(resp: requests.Response):
309309
predefined message indicating possible reasons for denial. For other
310310
status codes, returns the raw response text.
311311
"""
312-
if resp.status_code == 429:
312+
status = resp.status_code
313+
if status == 429:
313314
return "429: Too many requests made. Please obtain an API token or try again later."
314-
elif resp.status_code == 403:
315+
elif status == 403:
315316
return "403: Query request denied. Possible reasons include query exceeding server limits."
316-
return f"{resp.status_code}: {resp.json().get('code', 'Unknown type')}. {resp.json().get('description', "No description provided")}."
317+
j_txt = resp.json()
318+
return (
319+
f"{status}: {j_txt.get('code', 'Unknown type')}. "
320+
f"{j_txt.get('description', 'No description provided')}."
321+
)
317322

318323

319324
def _construct_api_requests(

0 commit comments

Comments
 (0)