"""The metadata object every getter returns alongside its DataFrame.
A dependency-free leaf on purpose. This class is the second half of the
``(DataFrame, metadata)`` return contract, so nearly every service module needs
it -- and while it lived in :mod:`dataretrieval.utils` beside the legacy query
machinery, needing it meant inheriting that module's whole HTTP stack
(transport, credentials, error policy) transitively. Here it costs its
consumers nothing but ``httpx``.
``dataretrieval.utils.BaseMetadata`` remains the public import.
"""
from __future__ import annotations
from typing import Any
import httpx
class BaseMetadata:
"""Base class for metadata.
Attributes
----------
url : str
Response url.
query_time: datetime.timedelta
Response elapsed time.
header: httpx.Headers
Response headers.
"""
# # not sure what statistic_info is
# self.statistic_info = None
# # disclaimer seems to be only part of importWaterML1
# self.disclaimer = None
# ``site_info`` is set by ``nwis`` / ``wqp``-specific metadata classes; the
# modern ``waterdata`` metadata leaves it unimplemented (use
# ``waterdata.get_monitoring_locations`` to retrieve site descriptions).
@property
def site_info(self) -> Any:
raise NotImplementedError(
"site_info must be implemented by BaseMetadata children"
)
# Pickles created after this class moved must remain readable by releases where
# its public import path was only ``dataretrieval.utils.BaseMetadata``.
BaseMetadata.__module__ = "dataretrieval.utils"