From 08c0f99d5a58d2db17cdfe999da30551dbeb792e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Haas?= Date: Tue, 16 Jun 2020 08:57:01 +0200 Subject: [PATCH] Update __init__.py Fixes home-assistant-ecosystem/python-netdata/issues/3 --- netdata/__init__.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/netdata/__init__.py b/netdata/__init__.py index 5055ea7..4d5e6a3 100644 --- a/netdata/__init__.py +++ b/netdata/__init__.py @@ -22,7 +22,7 @@ class Netdata(object): """A class for handling connections with a Netdata instance.""" - def __init__(self, host, loop, session, port=19999, data=None): + def __init__(self, host, loop, session, port=19999): """Initialize the connection to the Netdata instance.""" self._loop = loop self._session = session @@ -30,15 +30,10 @@ def __init__(self, host, loop, session, port=19999, data=None): self.port = port self.values = self.alarms = self.metrics = None self.base_url = _INSTANCE.format(host=host, port=port, api=API_VERSION) - if data is None: - self.endpoint = _ALL_METRIC_ENDPOINT - if data == "alarms": - self.endpoint = _ALARMS_ENDPOINT - if data == "data": - self.endpoint = _DATA_ENDPOINT async def get_data(self, resource): """Get detail for a resource from the data endpoint.""" + self.endpoint = _DATA_ENDPOINT url = "{}{}".format(self.base_url, self.endpoint.format(resource=resource)) try: @@ -56,6 +51,7 @@ async def get_data(self, resource): async def get_alarms(self): """Get alarms for a Netdata instance.""" + self.endpoint = _ALARMS_ENDPOINT url = "{}{}".format(self.base_url, self.endpoint) try: @@ -73,6 +69,7 @@ async def get_alarms(self): async def get_allmetrics(self): """Get all available metrics from a Netdata instance.""" + self.endpoint = _ALL_METRIC_ENDPOINT url = "{}{}".format(self.base_url, self.endpoint) try: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy