1
- # grafana-client [ ![ Github Actions Test ] ( https://github.com/panodata/grafana-client/workflows/Test/badge.svg )] ( https://github.com/panodata/grafana-client/actions?query=workflow%3ATest ) [ ![ GitHub license ] ( https://img.shields.io/github/license/panodata/grafana-client.svg?style=flat-square )] ( https://github.com/panodata/grafana-client/blob/master/LICENSE ) [ ![ Codecov ] ( https://img.shields.io/codecov/c/gh/panodata/grafana-client.svg?style=flat-square )] ( https://codecov.io/gh/panodata/grafana-client/ )
1
+ # grafana-client
2
2
3
- [ ![ PyPI] ( https://img.shields.io/pypi/v/grafana-client.svg?style=flat-square )] ( https://pypi.org/project/grafana-api/ ) [ ![ Conda] ( https://img.shields.io/conda/v/panodata/grafana-client.svg?style=flat-square )] ( https://anaconda.org/panodata/grafana-client )
3
+ [ ![ Tests] ( https://github.com/panodata/grafana-client/workflows/Test/badge.svg )] ( https://github.com/panodata/grafana-client/actions?query=workflow%3ATest )
4
+ [ ![ Test coverage] ( https://img.shields.io/codecov/c/gh/panodata/grafana-client.svg?style=flat-square )] ( https://codecov.io/gh/panodata/grafana-client/ )
5
+ [ ![ License] ( https://img.shields.io/github/license/panodata/grafana-client.svg?style=flat-square )] ( https://github.com/panodata/grafana-client/blob/main/LICENSE )
4
6
5
- ## What is this library for?
7
+ [ ![ PyPI] ( https://img.shields.io/pypi/v/grafana-client.svg?style=flat-square )] ( https://pypi.org/project/grafana-client/ )
8
+ [ ![ Python versions] ( https://img.shields.io/pypi/pyversions/grafana-client.svg?style=flat-square )] ( https://pypi.org/project/grafana-client/ )
9
+ [ ![ Status] ( https://img.shields.io/pypi/status/grafana-client.svg?style=flat-square )] ( https://pypi.org/project/grafana-client/ )
10
+ <!-- [](https://anaconda.org/panodata/grafana-client) -->
6
11
7
- Yet another Grafana API library for Python. Support Python 3 only.
12
+ ## About
8
13
9
- ## Requirements
10
-
11
- You need Python 3 and only the ` requests ` library installed.
14
+ A client library for the Grafana HTTP API, written in Python.
12
15
13
16
## History
14
17
15
- The library was originally conceived by Andrew Prokhorenkov at https://github.com/m0nhawk/grafana_api .
16
- Thank you very much for your efforts!
18
+ The library was originally conceived by [ Andrew Prokhorenkov] and contributors
19
+ as [ grafana_api] . Thank you very much for your efforts!
20
+
21
+ At [ future maintenance of ` grafana_api ` ] , we discussed the need for a fork
22
+ because the repository stopped receiving updates since more than a year.
23
+
24
+ While forking it, we renamed the package to ` grafana-client ` and slightly
25
+ trimmed the module namespace.
26
+
17
27
18
- ## Quick start
19
28
20
- Install the pip package:
29
+ ## Getting started
30
+
31
+ Install the package from PyPI.
21
32
22
33
```
23
- pip install -U grafana-client
34
+ pip install grafana-client --upgrade
24
35
```
25
36
26
- And then connect to your Grafana API endpoint:
37
+ Connect to your Grafana API endpoint using the ` GrafanaFace ` interface.
27
38
28
39
``` python
29
40
from grafana_client.grafana_face import GrafanaFace
30
41
31
- grafana = GrafanaFace(auth = ' abcde....' , host = ' api.my- grafana-host.com ' )
42
+ grafana = GrafanaFace(auth = ' abcde....' , host = ' grafana.example.org ' )
32
43
33
44
# Create user
34
- user = grafana.admin.create_user({" name" : " User" , " email" : " user@domain.com " , " login" : " user" , " password" : " userpassword" , " OrgId" : 1 })
45
+ user = grafana.admin.create_user({" name" : " User" , " email" : " user@example.org " , " login" : " user" , " password" : " userpassword" , " OrgId" : 1 })
35
46
36
47
# Change user password
37
48
user = grafana.admin.change_user_password(2 , " newpassword" )
@@ -58,29 +69,35 @@ grafana.organization.create_organization({"name":"new_organization"})
58
69
59
70
## Authentication
60
71
61
- There are two ways to autheticate to grafana api. Either use api token or basic auth.
72
+ There are two ways to authenticate to the Grafana API. Either use an API token,
73
+ or HTTP basic auth.
74
+
75
+ To use the admin API, you need to use HTTP basic auth, as stated at the
76
+ [ Grafana Admin API documentation] .
62
77
63
- To use admin API you need to use basic auth [ as stated here] ( https://grafana.com/docs/grafana/latest/http_api/admin/ )
64
78
65
79
``` python
66
- # Use basic authentication:
80
+ from grafana_client.grafana_face import GrafanaFace
67
81
82
+ # Use HTTP basic authentication
68
83
grafana = GrafanaFace(
69
- auth = (" username" ," password" ),
70
- host = ' api.my- grafana-host.com '
71
- )
84
+ auth = (" username" , " password" ),
85
+ host = ' grafana.example.org '
86
+ )
72
87
73
- # Use token
88
+ # Use Grafana API token
74
89
grafana = GrafanaFace(
75
- auth = ' abcdetoken ...' ,
76
- host = ' api.my- grafana-host.com '
77
- )
90
+ auth = ' eyJrIjoiWHg ...dGJpZCI6MX0= ' ,
91
+ host = ' grafana.example.org '
92
+ )
78
93
```
79
94
80
95
81
- ## Status of REST API realization
96
+ ## Status
97
+
98
+ This table outlines which parts of Grafana's HTTP API are covered by
99
+ ` grafana-client ` , see also [ Grafana HTTP API reference] .
82
100
83
- Work on API implementation still in progress.
84
101
85
102
| API | Status |
86
103
| ---| ---|
@@ -107,27 +124,34 @@ Work on API implementation still in progress.
107
124
## Software tests
108
125
109
126
``` shell
110
- pip install pytest
111
- pytest test
127
+ python setup.py test
112
128
```
113
129
114
- ## Release
115
130
116
- ``` shell
117
- pip install pep517 twine
118
- python -m pep517.build --source --binary --out-dir dist/ .
119
- twine upload --repository=testpypi dist/*
120
- ```
131
+ ## Acknowledgements
132
+
133
+ Thanks to all the [ contributors] who helped to co-create and conceive this
134
+ software in one way or another. You know who you are.
121
135
122
- ## Issue tracker
123
136
124
- Please report any bugs and enhancement ideas using the ` grafana-client ` issue tracker:
137
+ ## Contributing
125
138
126
- https://github.com/panodata/grafana-client/issues
139
+ Any kind of contribution and feedback are very much welcome! Just create an
140
+ issue or submit a patch if you think we should include a new feature, or to
141
+ report or fix a bug.
142
+
143
+ The issue tracker URL is: https://github.com/panodata/grafana-client/issues
127
144
128
- Feel free to also ask questions on the tracker.
129
145
130
146
## License
131
147
132
- ` grafana-client ` is licensed under the terms of the MIT License (see the file
133
- [ LICENSE] ( LICENSE ) ).
148
+ ` grafana-client ` is licensed under the terms of the MIT License, see [ LICENSE] file.
149
+
150
+
151
+ [ Andrew Prokhorenkov ] : https://github.com/m0nhawk/grafana_api
152
+ [ contributors ] : https://github.com/panodata/grafana-client/graphs/contributors
153
+ [ future maintenance of `grafana_api` ] : https://github.com/m0nhawk/grafana_api/issues/88
154
+ [ grafana_api ] : https://github.com/m0nhawk/grafana_api
155
+ [ Grafana Admin API documentation ] : https://grafana.com/docs/grafana/latest/http_api/admin/
156
+ [ Grafana HTTP API reference ] : https://grafana.com/docs/grafana/latest/http_api/
157
+ [ LICENSE ] : https://github.com/panodata/grafana-client/blob/main/LICENSE
0 commit comments