--- id: prometheus-api-client version: "0.7.2" license: unclear license_treatment: permissive maintenance: active --- # prometheus-api-client — A small python api to collect data from prometheus License: permissive · Maintenance: active · Downloads: 2.7M/mo ## What it is and what it does prometheus-api-client is a Python wrapper around Prometheus's HTTP API designed to simplify metrics collection and analysis. It provides the PrometheusConnect class for establishing connections to Prometheus servers, fetching metric lists, and executing instant and range queries. The library handles common tasks like label filtering, time-range chunking, and datetime parsing through its utils module. Beyond basic API wrapping, the package includes higher-level abstractions: MetricsList and Metric classes for working with result sets as objects, optional DataFrame conversion for data analysis workflows, and plotting support via matplotlib. Core dependencies are minimal (requests and dateparser), with pandas, numpy, and matplotlib available as optional extras. This modular design lets you use just the query layer without pulling in data-science dependencies if your use case doesn't need them. Use it for: - Fetch current or historical metrics from a Prometheus server for custom dashboards or alerting logic. - Aggregate and combine multiple time-series queries programmatically for analysis or reporting. - Export Prometheus metrics to pandas DataFrames for statistical analysis or machine-learning pipelines. - Build monitoring automation that queries Prometheus and triggers actions based on metric values. - Plot time-series data directly from Prometheus for ad-hoc visualization or debugging. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Connects to Prometheus monitoring systems and fetches time-series metrics via HTTP API, with tools for processing, aggregating, and optionally plotting or converting metrics to DataFrames. Yes. Active maintenance, permissive license, low install friction, no known vulnerabilities, and a straightforward API make this a solid choice for any Python application that needs to query Prometheus. Install the minimal version if you only need API access; add optional extras only if you need DataFrame or plotting support. ## Install pip install prometheus-api-client uv add prometheus-api-client poetry add prometheus-api-client ## Installing prometheus-api-client Before you install: Low friction: pure Python wheel with only 2 runtime dependencies (requests and dateparser). Active maintenance with a recent release and ongoing repository activity. Optional dependencies for DataFrame and plotting support can be installed separately to minimize footprint. License in practice: MIT license (permissive). No restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: pip install prometheus-api-client from prometheus_api_client import PrometheusConnect prom = PrometheusConnect(url="") metrics = prom.all_metrics() data = prom.custom_query(query="up") Verify before relying: - Whether the package supports authentication methods beyond bearer tokens and basic HTTP headers. - Performance characteristics when querying large time ranges or high-cardinality metrics. - Compatibility with Prometheus remote storage or federation setups. ## Package facts - License: not declared (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 2.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags prometheus metrics client, prometheus http api wrapper, fetch prometheus time series data, prometheus query library, prometheus monitoring integration, prometheus metrics processing, prometheus data aggregation, prometheus, metrics-collection, time-series [View on SkillFed](https://skillfed.io/packages/prometheus-api-client) · [View on PyPI](https://pypi.org/project/prometheus-api-client/)