This project has been archived by its maintainers, and is no longer receiving any updates.
grafana_api

What is this library for?
Yet another Grafana API library for Python. Support Python 3 only.
Requirements
You need Python 3 and only the requests library installed.
Quick start
Install the pip package:
pip install -U grafana_api
And then connect to your Grafana API endpoint:
from grafana_api.grafana_face import GrafanaFace
grafana_api = GrafanaFace(auth='abcde....', host='api.my-grafana-host.com')
# Search dashboards based on tag
grafana_api.search.search_dashboards(tag='applications')
# Find a user by email
user = grafana_api.users.find_user('test@test.com')
# Add user to team 2
grafana_api.teams.add_team_member(2, user["id"])
# Create or update a dashboard
grafana_api.dashboard.update_dashboard(dashboard={'dashboard': {...}, 'folderId': 0, 'overwrite': True})
# Delete a dashboard by UID
grafana_api.dashboard.delete_dashboard(dashboard_uid='abcdefgh')
Authentication
There are two ways to autheticate to grafana api. Either use api token or basic auth.
To use admin API you need to use basic auth as stated here
# Use basic authentication:
grafana_api = GrafanaFace(
auth=("username","password"),
host='api.my-grafana-host.com'
)
# Use token
grafana_api = GrafanaFace(
auth='abcdetoken...',
host='api.my-grafana-host.com'
)
Status of REST API realization
Work on API implementation still in progress.
| API | Status |
|---|---|
| Admin | + |
| Alerting | - |
| Alerting Notification Channels | + |
| Annotations | + |
| Authentication | +- |
| Dashboard | + |
| Dashboard Versions | - |
| Dashboard Permissions | + |
| Data Source | + |
| Folder | + |
| Folder Permissions | + |
| Folder/Dashboard Search | +- |
| Organisation | + |
| Other | + |
| Preferences | + |
| Snapshot | + |
| Teams | + |
| User | + |
Issue tracker
Please report any bugs and enhancement ideas using the grafana_api issue tracker:
https://github.com/m0nhawk/grafana_api/issues
Feel free to also ask questions on the tracker.
License
grafana_api is licensed under the terms of the MIT License (see the file
LICENSE).
Release files for grafana-api 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| grafana_api-1.0.3.tar.gz | 24.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| grafana_api-1.0.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 51.7 kB
Release files / grafana_api-1.0.3.tar.gz
| Download URL | grafana_api-1.0.3.tar.gz |
|---|---|
| Size | 24.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d541ea1a5b7efafa56c5f04053ed42b2d972a6aa313bc4881dd192aeb0706e2e
|
|
BLAKE2b-256 checksum How to use checksums |
f8f4c1a1ae50758ca7b65ea909c536f28204e6e8cae48822c394762a3d7e0e35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
|
Release files / grafana_api-1.0.3-py2.py3-none-any.whl
| Download URL | grafana_api-1.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
30caef227025ecdb5662b242aaae921b89b58959566d83a5948523c8138e98ce
|
|
BLAKE2b-256 checksum How to use checksums |
f43e8d116cc17c1a2bf2541e567c791d3b94de2b561fb85a566e85c89a9ce45d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
|