Unable to send request to the grafana using basic authentication

836 views Asked by At

I'm using Grafana free version (v8.5.0). I'm using python 3.7 and sending requests to Grafana. But it is not working. Below is my Code.

import requests

import json

base_url="https://MY_USERNAME:[email protected]"

resp = requests.get(base_url+"/app/dashboards/home", verify=True)

data = resp.json()

print(data)

Output:

{'message':'invalid username or password', 'traceId':'1710926f6a9a7120'}

Thanks In Advance...

1

There are 1 answers

1
mklsimon On
import requests

base_url="https://santoshburadalearning.grafana.net"

s = requests.Session()
s.auth = ('MY_USERNAME', 'MY_PASSWORD')
resp = s.get(base_url+ "/api/search/", verify=False)
data = resp.json()

print(data)