Skip to content

Commit 6124eb1

Browse files
committed
Adjust documentation
1 parent b9e6e17 commit 6124eb1

File tree

3 files changed

+70
-44
lines changed

3 files changed

+70
-44
lines changed

README.md

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
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
22

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)
46

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+
<!-- [![Conda](https://img.shields.io/conda/v/panodata/grafana-client.svg?style=flat-square)](https://anaconda.org/panodata/grafana-client) -->
611

7-
Yet another Grafana API library for Python. Support Python 3 only.
12+
## About
813

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.
1215

1316
## History
1417

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+
1727

18-
## Quick start
1928

20-
Install the pip package:
29+
## Getting started
30+
31+
Install the package from PyPI.
2132

2233
```
23-
pip install -U grafana-client
34+
pip install grafana-client --upgrade
2435
```
2536

26-
And then connect to your Grafana API endpoint:
37+
Connect to your Grafana API endpoint using the `GrafanaFace` interface.
2738

2839
```python
2940
from grafana_client.grafana_face import GrafanaFace
3041

31-
grafana = GrafanaFace(auth='abcde....', host='api.my-grafana-host.com')
42+
grafana = GrafanaFace(auth='abcde....', host='grafana.example.org')
3243

3344
# 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})
3546

3647
# Change user password
3748
user = grafana.admin.change_user_password(2, "newpassword")
@@ -58,29 +69,35 @@ grafana.organization.create_organization({"name":"new_organization"})
5869

5970
## Authentication
6071

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].
6277

63-
To use admin API you need to use basic auth [as stated here](https://grafana.com/docs/grafana/latest/http_api/admin/)
6478

6579
```python
66-
# Use basic authentication:
80+
from grafana_client.grafana_face import GrafanaFace
6781

82+
# Use HTTP basic authentication
6883
grafana = GrafanaFace(
69-
auth=("username","password"),
70-
host='api.my-grafana-host.com'
71-
)
84+
auth=("username", "password"),
85+
host='grafana.example.org'
86+
)
7287

73-
# Use token
88+
# Use Grafana API token
7489
grafana = GrafanaFace(
75-
auth='abcdetoken...',
76-
host='api.my-grafana-host.com'
77-
)
90+
auth='eyJrIjoiWHg...dGJpZCI6MX0=',
91+
host='grafana.example.org'
92+
)
7893
```
7994

8095

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].
82100

83-
Work on API implementation still in progress.
84101

85102
| API | Status |
86103
|---|---|
@@ -107,27 +124,34 @@ Work on API implementation still in progress.
107124
## Software tests
108125

109126
```shell
110-
pip install pytest
111-
pytest test
127+
python setup.py test
112128
```
113129

114-
## Release
115130

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.
121135

122-
## Issue tracker
123136

124-
Please report any bugs and enhancement ideas using the `grafana-client` issue tracker:
137+
## Contributing
125138

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
127144

128-
Feel free to also ask questions on the tracker.
129145

130146
## License
131147

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

docs/backlog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
- `python -m pep517.build --source --binary --out-dir dist/ .`
44
pep517.build is deprecated. Consider switching to https://pypi.org/project/build/
5+
- Format code with `black` and `isort``
6+
- Clarify *"To use admin API you need to use basic auth"*, see README.

setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[metadata]
22
name = grafana-client
3-
friendly_name = Python Grafana API
4-
description = Yet another Python library for Grafana API
3+
friendly_name = Grafana client
4+
description = A client library for the Grafana HTTP API, written in Python
55
long_description = file: README.md
66
long_description_content_type = text/markdown
77
license = MIT
@@ -26,7 +26,7 @@ classifiers =
2626
Topic :: Software Development
2727
Topic :: Software Development :: Libraries
2828
Topic :: Software Development :: Libraries :: Python Modules
29-
keywords = grafana api
29+
keywords = grafana http api grafana-client grafana-api automation
3030

3131
[options]
3232
use_scm_version = True

0 commit comments

Comments
 (0)