Skip to content

Commit

Permalink
Make GrafanaApi(auth=) an optional argument
Browse files Browse the repository at this point in the history
This makes it easier to connect to Grafana instances that do not require
authentication.
  • Loading branch information
amotl committed May 25, 2022
1 parent bcd9506 commit 191502d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,12 @@
## in progress


## 2.3.0 (2022-05-26)

* Make `GrafanaApi(auth=)` an optional argument. This makes it easier to
connect to Grafana instances that do not require authentication.


## 2.2.1 (2022-05-20)

* Fix annotations query string parameter `dashboardId`. Thanks, @richbon75!
Expand Down
2 changes: 1 addition & 1 deletion grafana_client/api.py
Expand Up @@ -20,7 +20,7 @@
class GrafanaApi:
def __init__(
self,
auth,
auth=None,
host="localhost",
port=None,
url_path_prefix="",
Expand Down
9 changes: 5 additions & 4 deletions grafana_client/client.py
Expand Up @@ -91,10 +91,11 @@ def construct_api_url():
self.url = construct_api_url()

self.s = requests.Session()
if not isinstance(self.auth, tuple):
self.auth = TokenAuth(self.auth)
else:
self.auth = requests.auth.HTTPBasicAuth(*self.auth)
if self.auth is not None:
if not isinstance(self.auth, tuple):
self.auth = TokenAuth(self.auth)
else:
self.auth = requests.auth.HTTPBasicAuth(*self.auth)

def __getattr__(self, item):
def __request_runnner(url, json=None, headers=None):
Expand Down

0 comments on commit 191502d

Please sign in to comment.