+ def create_datasource(self, datasource_name, datasource_type, datasource_url):
+ try:
+ datasource_data = {
+ "name": datasource_name,
+ "type": datasource_type,
+ "url": datasource_url,
+ "access": "proxy",
+ "readOnly": False,
+ "basicAuth": False,
+ }
+ response = requests.request(
+ "POST",
+ self.url + "/api/datasources",
+ data=json.dumps(datasource_data),
+ headers=self.headers,
+ )
+ log.info("Datasource %s is created in Grafana", datasource_name)
+ log.info("************* response: {}".format(response.__dict__))
+ return response
+ except Exception:
+ log.exception("Exception processing request for creating datasource: ")
+