def upload_to_grafana(json, server, api_key, verify=True):
'''
upload_to_grafana tries to upload dashboard to grafana and prints response
:param json - dashboard json generated by grafanalib
:param server - grafana server name
:param api_key - grafana api key with read and write privileges
'''
headers = {'Authorization': f"Bearer <apikey>","Accept": "application/json", 'Content-Type': 'application/json'}
r = requests.post(f"<endpoint url of the Azure managed grafana instance ", data=json, headers=headers, verify=False)
# TODO: add error handling
print(f"{r.status_code} - {r.content}")
I used this function to upload the dashboard created using python to the Azure managed Grafana instance .I assigned the user role as User Access administrator .When calling this function (using https )it returns 401 error and it returns connection error when using http. How do I solve this ..Thanks in advance for the help