# \#python

**URL:** https://community.grafana.com/tag/python/142.md

[Latest](https://community.grafana.com/latest.md) · [Categories](https://community.grafana.com/categories.md) · [Tags](https://community.grafana.com/tags.md)

---

## [Does the Grafana Foundation SDK get much use?](https://community.grafana.com/t/does-the-grafana-foundation-sdk-get-much-use/160491)

<div class="topic-metadata">

**Author:** [@garethsrt](https://community.grafana.com/u/garethsrt)\
**Replies:** 0\
**Last updated:** [December 23, 2025, 1:03pm UTC](https://community.grafana.com/t/does-the-grafana-foundation-sdk-get-much-use/160491 "2025-12-23T13:03:15Z")

</div>

Hi all, I really want to define dashboards in code (instead of via the UI) and I thought the Foundation SDK would be the answer and quick & easy to pick up (e.g. like Terraform or similar), but it does seem to take a bi…

---

## [Can\`t profiling python via auto-instrumentation by Alloy](https://community.grafana.com/t/can-t-profiling-python-via-auto-instrumentation-by-alloy/148624)

<div class="topic-metadata">

**Author:** [@patsevanton](https://community.grafana.com/u/patsevanton)\
**Replies:** 0\
**Last updated:** [April 20, 2025, 4:14am UTC](https://community.grafana.com/t/can-t-profiling-python-via-auto-instrumentation-by-alloy/148624 "2025-04-20T04:14:58Z")

</div>

Hello! I try profiling python via auto-instrumentation by Alloy. My values for Alloy: alloy: securityContext: privileged: true runAsUser: 0 runAsGroup: 0 fsGroup: 0 configMap: create: true …

---

## [Metrics using python](https://community.grafana.com/t/metrics-using-python/147801)

<div class="topic-metadata">

**Author:** [@mointj](https://community.grafana.com/u/mointj)\
**Replies:** 2\
**Last updated:** [April 7, 2025, 10:36am UTC](https://community.grafana.com/t/metrics-using-python/147801 "2025-04-07T10:36:18Z")

</div>

Need support on connecting grafana from python & Connect to Grafana dashboard through Python code.. and check the metrics if the metrics is greater than couple of days value, inform the details What Grafana version an…

---

## [Formating json response from my own raw http server (data source using plugin "JSON")](https://community.grafana.com/t/formating-json-response-from-my-own-raw-http-server-data-source-using-plugin-json/142792)

<div class="topic-metadata">

**Author:** [@captainflam](https://community.grafana.com/u/captainflam)\
**Replies:** 1\
**Last updated:** [February 6, 2025, 3:27pm UTC](https://community.grafana.com/t/formating-json-response-from-my-own-raw-http-server-data-source-using-plugin-json/142792 "2025-02-06T15:27:56Z")

</div>

Hi ! I’m a newbie grafana user and I try to “play” with it. I wrote a simple python script using a standard http server (http.server). On grafana side I created a data source pointing on localhost:5000. It looks good …

---

## [Read data file from file system](https://community.grafana.com/t/read-data-file-from-file-system/142022)

<div class="topic-metadata">

**Author:** [@greggynapalm](https://community.grafana.com/u/greggynapalm)\
**Replies:** 2\
**Last updated:** [February 2, 2025, 5:54pm UTC](https://community.grafana.com/t/read-data-file-from-file-system/142022 "2025-02-02T17:54:36Z")

</div>

Hi! I want to copy raw data from Loki to process it alongside Python(preferably) or Golang. My Loki instance is configured this way. auth\_enabled: false chunk\_store\_config: max\_look\_back\_period: 168h compactor: shar…

---

## [Easy way to build dashboards with python?](https://community.grafana.com/t/easy-way-to-build-dashboards-with-python/109953)

<div class="topic-metadata">

**Author:** [@liorhaz](https://community.grafana.com/u/liorhaz)\
**Replies:** 1\
**Last updated:** [January 14, 2025, 6:55pm UTC](https://community.grafana.com/t/easy-way-to-build-dashboards-with-python/109953 "2025-01-14T18:55:25Z")

</div>

hi, is there an easy way to build dashboards in grafana with python but not in a json way but more in object/functions? json is not the easiest way to understand what goes to where in a dashboards, i want to build from…

---

## ["grafana-client" - A client library for accessing the Grafana HTTP API, written in Python](https://community.grafana.com/t/grafana-client-a-client-library-for-accessing-the-grafana-http-api-written-in-python/68101)

<div class="topic-metadata">

**Author:** [@amotl](https://community.grafana.com/u/amotl)\
**Replies:** 1\
**Last updated:** [February 7, 2023, 6:27pm UTC](https://community.grafana.com/t/grafana-client-a-client-library-for-accessing-the-grafana-http-api-written-in-python/68101 "2023-02-07T18:27:52Z")

</div>

Introduction While we introduced you to grafana-wtf the other day, we never had the chance to tell you about grafana-client. It is the low-level library used by grafana-wtf, About grafana-client » A client library for a…

---

## [Import dashboard from file via API](https://community.grafana.com/t/import-dashboard-from-file-via-api/22266)

<div class="topic-metadata">

**Author:** [@dhyatas](https://community.grafana.com/u/dhyatas)\
**Replies:** 9\
**Last updated:** [June 26, 2024, 9:19am UTC](https://community.grafana.com/t/import-dashboard-from-file-via-api/22266 "2024-06-26T09:19:45Z")

</div>

Good Day I am trying to import a dashboard exported from the Grafana GUI via a Curl. The command I am using for import is: curl -X POST --insecure -H "Authorization: Bearer $apikey" -H "Content-Type: application/json"…

---

## [401 Error on writing logs to Loki with logging\_loki python library](https://community.grafana.com/t/401-error-on-writing-logs-to-loki-with-logging-loki-python-library/110500)

<div class="topic-metadata">

**Author:** [@daviddeclercq](https://community.grafana.com/u/daviddeclercq)\
**Replies:** 2\
**Last updated:** [December 20, 2023, 10:36pm UTC](https://community.grafana.com/t/401-error-on-writing-logs-to-loki-with-logging-loki-python-library/110500 "2023-12-20T22:36:04Z")

</div>

Hi, I am a complete noob on grafana. I am trying to send some logs from my VM to my loki data source. I have followed this documentation: #### Using Grafana with Logs Whether you are using Grafana on-prem or Grafana C…

---

## [Grafana HTTP request through python to query data-source](https://community.grafana.com/t/grafana-http-request-through-python-to-query-data-source/117648)

<div class="topic-metadata">

**Author:** [@akiator9](https://community.grafana.com/u/akiator9)\
**Replies:** 2\
**Last updated:** [March 22, 2024, 1:18pm UTC](https://community.grafana.com/t/grafana-http-request-through-python-to-query-data-source/117648 "2024-03-22T13:18:56Z")

</div>

I am using Grafana official documentation as reference to query a data source via python. Should queries be sent as payload or params when using Grafana /api/ds/query I have come up the following Python code but it r…

---

## [Programmatically creating multiple dashboards from the JSON of one master dsahboard](https://community.grafana.com/t/programmatically-creating-multiple-dashboards-from-the-json-of-one-master-dsahboard/115687)

<div class="topic-metadata">

**Author:** [@control148](https://community.grafana.com/u/control148)\
**Replies:** 4\
**Last updated:** [February 29, 2024, 1:15pm UTC](https://community.grafana.com/t/programmatically-creating-multiple-dashboards-from-the-json-of-one-master-dsahboard/115687 "2024-02-29T13:15:46Z")

</div>

Hello, I am currently attempting to write a program using a combination of command line and Python3 that will contact the Grafana server, download a copy of the JSON of one dashboard that I have designated to be the mas…

---

## [Just add agent to python docker image?](https://community.grafana.com/t/just-add-agent-to-python-docker-image/111409)

<div class="topic-metadata">

**Author:** [@scottedchapman](https://community.grafana.com/u/scottedchapman)\
**Replies:** 8\
**Last updated:** [January 20, 2024, 12:37am UTC](https://community.grafana.com/t/just-add-agent-to-python-docker-image/111409 "2024-01-20T00:37:22Z")

</div>

I’ve got a python app I am deploying with Docker. For reasons that I can’t explain I can’t just run the Grafana agent in a separate container and give it access to the logs. I am considering just copying the static agen…

---

## ["loki-client" python library does not work](https://community.grafana.com/t/loki-client-python-library-does-not-work/110364)

<div class="topic-metadata">

**Author:** [@ralvez](https://community.grafana.com/u/ralvez)\
**Replies:** 3\
**Last updated:** [December 19, 2023, 4:35pm UTC](https://community.grafana.com/t/loki-client-python-library-does-not-work/110364 "2023-12-19T16:35:19Z")

</div>

Hello team. I installed the “loki-client” library available in loki-client · PyPI I verified that the install process was successfully executed in my environment: root@host:/project/jupyter# docker-compose exec jupyte…

---

## [Invalid API key?](https://community.grafana.com/t/invalid-api-key/108054)

<div class="topic-metadata">

**Author:** [@vincentteplitxky](https://community.grafana.com/u/vincentteplitxky)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 8:51pm UTC](https://community.grafana.com/t/invalid-api-key/108054 "2023-11-17T20:51:51Z")

</div>

What Grafana version and what operating system are you using? Grafana open source in a container, itself in an Azure web app What are you trying to achieve? Using a Jupyter Notebook & Python, I would like to progr…

---

## [Guidance Needed - Exploring new reporting solutions, with API feed](https://community.grafana.com/t/guidance-needed-exploring-new-reporting-solutions-with-api-feed/107015)

<div class="topic-metadata">

**Author:** [@jade69](https://community.grafana.com/u/jade69)\
**Replies:** 2\
**Last updated:** [November 3, 2023, 1:31pm UTC](https://community.grafana.com/t/guidance-needed-exploring-new-reporting-solutions-with-api-feed/107015 "2023-11-03T13:31:33Z")

</div>

Hi there! This is a general enquiry about Grafana. Just want to ensure that this will be the right solution for our company before we dive in and become fully invested. We are currently using Looker studio for our BI r…

---

## [How to send formatted json data to labels and prettify it?](https://community.grafana.com/t/how-to-send-formatted-json-data-to-labels-and-prettify-it/105568)

<div class="topic-metadata">

**Author:** [@jackoman69](https://community.grafana.com/u/jackoman69)\
**Replies:** 0\
**Last updated:** [October 13, 2023, 9:21pm UTC](https://community.grafana.com/t/how-to-send-formatted-json-data-to-labels-and-prettify-it/105568 "2023-10-13T21:21:44Z")

</div>

I’m a newbie in Grafana Loki plugin and I have one very interesting question. Recently, I set up self-hosted grafana-server and Loki like systemctl services. Writing own python library to send data from Django requests…

---

## [How to change text in panel using python script?](https://community.grafana.com/t/how-to-change-text-in-panel-using-python-script/102630)

<div class="topic-metadata">

**Author:** [@aaronhuston53](https://community.grafana.com/u/aaronhuston53)\
**Replies:** 3\
**Last updated:** [August 31, 2023, 9:46pm UTC](https://community.grafana.com/t/how-to-change-text-in-panel-using-python-script/102630 "2023-08-31T21:46:58Z")

</div>

Friends, please tell me: how to write a request for updating the text in the panel? I’ve tried different ways, but it doesn’t work. My code is below: import requests grafana\_url = 'http://127.0.0.101:3000' api\_key =…

---

## [Use loki docker plugin to label python logger](https://community.grafana.com/t/use-loki-docker-plugin-to-label-python-logger/101302)

<div class="topic-metadata">

**Author:** [@lekspek](https://community.grafana.com/u/lekspek)\
**Replies:** 2\
**Last updated:** [August 20, 2023, 5:11am UTC](https://community.grafana.com/t/use-loki-docker-plugin-to-label-python-logger/101302 "2023-08-20T05:11:47Z")

</div>

My goal: Label the python logger from docker containers, and also keep the docker container label. What I did and what works for now: I have a working Loki instance and installed Loki as a docker plugin on the local en…

---

## [Login with python](https://community.grafana.com/t/login-with-python/100150)

<div class="topic-metadata">

**Author:** [@testidrrtrtr](https://community.grafana.com/u/testidrrtrtr)\
**Replies:** 0\
**Last updated:** [July 31, 2023, 12:16pm UTC](https://community.grafana.com/t/login-with-python/100150 "2023-07-31T12:16:40Z")

</div>

Hi everyone I want kindly ask you for help; how can I log into Grafana via python? thanks

---

## [\[OSS tool\] Write Grafana pre-build dashboards in Python](https://community.grafana.com/t/oss-tool-write-grafana-pre-build-dashboards-in-python/91342)

<div class="topic-metadata">

**Author:** [@fzyzcjy](https://community.grafana.com/u/fzyzcjy)\
**Replies:** 3\
**Last updated:** [July 13, 2023, 12:20pm UTC](https://community.grafana.com/t/oss-tool-write-grafana-pre-build-dashboards-in-python/91342 "2023-07-13T12:20:24Z")

</div>

GitHub: GitHub - fzyzcjy/grafana\_dashboard\_python: Write Grafana dashboards in Python, without losing thousands of dashboards in the zoo Shortly speaking, in addition to the traditional “generate Grafana dashboards from…

---

## [Refresh Grafana Dashboard triggered by Python-Code](https://community.grafana.com/t/refresh-grafana-dashboard-triggered-by-python-code/89754)

<div class="topic-metadata">

**Author:** [@tichribra](https://community.grafana.com/u/tichribra)\
**Replies:** 3\
**Last updated:** [June 17, 2023, 2:14pm UTC](https://community.grafana.com/t/refresh-grafana-dashboard-triggered-by-python-code/89754 "2023-06-17T14:14:43Z")

</div>

Hello together, I would like to achieve that the refresh of my grafana dashboard is triggered by python code. This way I can make sure that always the latest data is displayed on the dashboard without setting a very sho…

---

## [Send traces from OTLP python app directly to local Tempo instance](https://community.grafana.com/t/send-traces-from-otlp-python-app-directly-to-local-tempo-instance/89282)

<div class="topic-metadata">

**Author:** [@phoeneous](https://community.grafana.com/u/phoeneous)\
**Replies:** 3\
**Last updated:** [June 8, 2023, 10:26pm UTC](https://community.grafana.com/t/send-traces-from-otlp-python-app-directly-to-local-tempo-instance/89282 "2023-06-08T22:26:10Z")

</div>

Hello. I’m currently doing a POC for Tempo but completely local at this time. Here’s what I have running locally: Python flask app manually instrumented with OTLP Prometheus:9090 Grafana:3000 Tempo:3200 According to…

---

## [How to create a dashboard with a graph through the http api?](https://community.grafana.com/t/how-to-create-a-dashboard-with-a-graph-through-the-http-api/88390)

<div class="topic-metadata">

**Author:** [@ivoavtavares](https://community.grafana.com/u/ivoavtavares)\
**Replies:** 5\
**Last updated:** [June 7, 2023, 4:37pm UTC](https://community.grafana.com/t/how-to-create-a-dashboard-with-a-graph-through-the-http-api/88390 "2023-06-07T16:37:18Z")

</div>

I have a postgresql datasource in my grafana docker container. This database has a table called posts, where 1 column is of type Time, and another of type Float. I’m trying to create, using the http api, a dashboard wi…

---

## [Trying to export Grafana Alert Rules in Python through API, but getting wrong version of the alert rule](https://community.grafana.com/t/trying-to-export-grafana-alert-rules-in-python-through-api-but-getting-wrong-version-of-the-alert-rule/86032)

<div class="topic-metadata">

**Author:** [@emil8560](https://community.grafana.com/u/emil8560)\
**Replies:** 0\
**Last updated:** [April 19, 2023, 7:26am UTC](https://community.grafana.com/t/trying-to-export-grafana-alert-rules-in-python-through-api-but-getting-wrong-version-of-the-alert-rule/86032 "2023-04-19T07:26:31Z")

</div>

Hi, Im currently trying to export Grafana alert rules through the alerts API in version 9.0.5 Grafana. I am able to get a JSON response with all the information that i want, but the alert rules i export are the first st…

---

## [API calls returning 401 unauthorized in curl, python, etc. Possibly due to LDAP?](https://community.grafana.com/t/api-calls-returning-401-unauthorized-in-curl-python-etc-possibly-due-to-ldap/67347)

<div class="topic-metadata">

**Author:** [@cwirk2000](https://community.grafana.com/u/cwirk2000)\
**Replies:** 5\
**Last updated:** [April 13, 2023, 8:05am UTC](https://community.grafana.com/t/api-calls-returning-401-unauthorized-in-curl-python-etc-possibly-due-to-ldap/67347 "2023-04-13T08:05:50Z")

</div>

What Grafana version and what operating system are you using? Windows, Grafana 7.5.11 What are you trying to achieve? I am trying to get data from API calls (any API call right now for testing, but my goal is to t…

---

## [Show grafana in QWebEngineView Python](https://community.grafana.com/t/show-grafana-in-qwebengineview-python/71476)

<div class="topic-metadata">

**Author:** [@mtapia1](https://community.grafana.com/u/mtapia1)\
**Replies:** 2\
**Last updated:** [January 11, 2023, 11:02am UTC](https://community.grafana.com/t/show-grafana-in-qwebengineview-python/71476 "2023-01-11T11:02:41Z")

</div>

Hello everyone, i’m principiant in grafana, and i trying show a dashboard from grafana in python. For this i’m using QtWebEngineWidgets and i have the next error: js: Uncaught SyntaxError: Unexpected token ‘=’ If you’r…

---

## [Can not send my dashboard to Grafana via API](https://community.grafana.com/t/can-not-send-my-dashboard-to-grafana-via-api/78975)

<div class="topic-metadata">

**Author:** [@mahiyouu](https://community.grafana.com/u/mahiyouu)\
**Replies:** 17\
**Last updated:** [January 5, 2023, 11:45am UTC](https://community.grafana.com/t/can-not-send-my-dashboard-to-grafana-via-api/78975 "2023-01-05T11:45:54Z")

</div>

Hi guys, I am trying to uload the following to my Grafana localhost: { “annotations”: { “list”: \[ { “builtIn”: 1, “datasource”: { “type”: “grafana”, “uid”: “-- Grafana --” }, “enable”: true, “hide”: true, “i…

---

## [Update an existing alert rule via Alerting provisioning API](https://community.grafana.com/t/update-an-existing-alert-rule-via-alerting-provisioning-api/76642)

<div class="topic-metadata">

**Author:** [@lexpec](https://community.grafana.com/u/lexpec)\
**Replies:** 1\
**Last updated:** [November 25, 2022, 8:21am UTC](https://community.grafana.com/t/update-an-existing-alert-rule-via-alerting-provisioning-api/76642 "2022-11-25T08:21:41Z")

</div>

Hi everyone :wave: Grafana version: 9.0.2 and operating system: Ubuntu I’m trying to change the name of an existing alert rule via Alerting provisioning API. In documentation I found this method: Here is my Python c…

---

## [Automate Grafana dashboard migration using Python API](https://community.grafana.com/t/automate-grafana-dashboard-migration-using-python-api/67942)

<div class="topic-metadata">

**Author:** [@mkniagara](https://community.grafana.com/u/mkniagara)\
**Replies:** 1\
**Last updated:** [July 1, 2022, 11:02am UTC](https://community.grafana.com/t/automate-grafana-dashboard-migration-using-python-api/67942 "2022-07-01T11:02:51Z")

</div>

Hi, I’m trying to use Python API to automatically Export existing Grafana dashboards from a source URL / Folder and Import them to destination URL / Folder. Providing you code snippet below for the same where I’m getti…

---

## [\<Response \[412\]\> {'message': 'The dashboard has been changed by someone else', 'status': 'version-mismatch'}](https://community.grafana.com/t/response-412-message-the-dashboard-has-been-changed-by-someone-else-status-version-mismatch/65152)

<div class="topic-metadata">

**Author:** [@alexandrutomescu23](https://community.grafana.com/u/alexandrutomescu23)\
**Replies:** 1\
**Last updated:** [May 26, 2022, 5:37pm UTC](https://community.grafana.com/t/response-412-message-the-dashboard-has-been-changed-by-someone-else-status-version-mismatch/65152 "2022-05-26T17:37:10Z")

</div>

I am currently using Grafana 8.2.2 and I am trying to make a change to multiple dashboards. Everytime I use a POST request I get this error: \<Response \[412\]\> {‘message’: ‘The dashboard has been changed by someone else’…

[Next page](https://community.grafana.com/tag/python/142.md?match_all_tags=true&page=1&tags%5B%5D=python)
