Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasTurner23 committed Dec 1, 2024
1 parent dc7fa06 commit 80ff39a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/workflows/airqo_etl_utils/airqo_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def extract_devices_data_(
logger.exception(f"An error occured: {e} - device {device['name']}")
continue
if isinstance(data, pd.DataFrame) and data.empty:
logger.exception(f"No data received from {device['name']}")
logger.warning(f"No data received from {device['name']}")
continue

if isinstance(data, pd.DataFrame) and not data.empty:
Expand Down
9 changes: 4 additions & 5 deletions src/workflows/airqo_etl_utils/data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def thingspeak(
read_key (str): The API key to authenticate the request for the specified channel.
Returns:
Optional[Tuple[List[Dict[str, Any]], Dict[str, Any]]]:
Optional[Tuple[List[Dict[str, Any]], Dict[str, Any], bool]]:
- A list of dictionaries containing the channel feeds data.
- A dictionary containing metadata about the channel.
- Returns `None` if no valid data is found or an error occurs.
Expand Down Expand Up @@ -116,7 +116,7 @@ def iqair(
- "monthly": Monthly aggregated data.
Returns:
pd.DataFrame: A DataFrame containing the retrieved data, or an empty DataFrame in case of errors or no data.
Union[List, Dict]: A list or dictionary containing the retrieved data, or `None` in case of errors or no data.
Raises:
ValueError: If an invalid resolution is provided or if the response data is invalid or malformed.
Expand All @@ -142,10 +142,9 @@ def iqair(
device_id = device.get("serial_number")
if not base_url or not device_id:
logger.exception(
ValueError(
"Device information must include 'api_code' and 'serial_number'."
)
"Device information must include 'api_code' and 'serial_number'."
)

url = f"{base_url}/{device_id}"
logger.info(f"Fetching data from URL: {url}")

Expand Down

0 comments on commit 80ff39a

Please sign in to comment.