diff --git a/prometheus_api_client/__init__.py b/prometheus_api_client/__init__.py index 47176ab..c19cd43 100644 --- a/prometheus_api_client/__init__.py +++ b/prometheus_api_client/__init__.py @@ -3,8 +3,21 @@ __title__ = "prometheus-connect" __version__ = "0.5.7" -from .prometheus_connect import * # noqa F403 -from .metric import Metric # noqa F401 -from .metrics_list import MetricsList # noqa F401 -from .metric_snapshot_df import MetricSnapshotDataFrame # noqa F401 -from .metric_range_df import MetricRangeDataFrame # noqa F401 +from .exceptions import PrometheusApiClientException, MetricValueConversionError +def __getattr__(name): + if name == "PrometheusConnect": + from .prometheus_connect import PrometheusConnect + return PrometheusConnect + elif name == "Metric": + from .metric import Metric + return Metric + elif name == "MetricsList": + from .metrics_list import MetricsList + return MetricsList + elif name == "MetricSnapshotDataFrame": + from .metric_snapshot_df import MetricSnapshotDataFrame + return MetricSnapshotDataFrame + elif name == "MetricRangeDataFrame": + from .metric_range_df import MetricRangeDataFrame + return MetricRangeDataFrame + raise AttributeError(f"module {__name__} has no attribute {name}")