diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-11 15:00:19 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 15:00:19 +0000 |
commit | 6f54a92308bd52bc28d09dedd76fe63fec32eef6 (patch) | |
tree | 2d1f8327b8c9884bd3f96932f9eb0a14b2d85b88 | |
parent | 79700a7d87016964eb35799d17bba0db6dcc445e (diff) |
automatic import of python-grafana-api
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-grafana-api.spec | 392 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 394 insertions, 0 deletions
@@ -0,0 +1 @@ +/grafana_api-1.0.3.tar.gz diff --git a/python-grafana-api.spec b/python-grafana-api.spec new file mode 100644 index 0000000..db3d02e --- /dev/null +++ b/python-grafana-api.spec @@ -0,0 +1,392 @@ +%global _empty_manifest_terminate_build 0 +Name: python-grafana-api +Version: 1.0.3 +Release: 1 +Summary: Yet another Python library for Grafana API +License: MIT +URL: https://github.com/m0nhawk/grafana_api/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f8/f4/c1a1ae50758ca7b65ea909c536f28204e6e8cae48822c394762a3d7e0e35/grafana_api-1.0.3.tar.gz +BuildArch: noarch + +Requires: python3-requests +Requires: python3-codecov +Requires: python3-coverage +Requires: python3-unittest-xml-reporting +Requires: python3-requests-mock + +%description +# grafana_api [](https://github.com/m0nhawk/grafana_api/actions?query=workflow%3ATest) [](https://github.com/m0nhawk/grafana_api/blob/master/LICENSE) [](https://codecov.io/gh/m0nhawk/grafana_api/) + +[](https://pypi.org/project/grafana-api/) [](https://anaconda.org/m0nhawk/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: + +```python +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](https://grafana.com/docs/grafana/latest/http_api/admin/) + +```python +# 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](LICENSE)). + + + + +%package -n python3-grafana-api +Summary: Yet another Python library for Grafana API +Provides: python-grafana-api +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-grafana-api +# grafana_api [](https://github.com/m0nhawk/grafana_api/actions?query=workflow%3ATest) [](https://github.com/m0nhawk/grafana_api/blob/master/LICENSE) [](https://codecov.io/gh/m0nhawk/grafana_api/) + +[](https://pypi.org/project/grafana-api/) [](https://anaconda.org/m0nhawk/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: + +```python +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](https://grafana.com/docs/grafana/latest/http_api/admin/) + +```python +# 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](LICENSE)). + + + + +%package help +Summary: Development documents and examples for grafana-api +Provides: python3-grafana-api-doc +%description help +# grafana_api [](https://github.com/m0nhawk/grafana_api/actions?query=workflow%3ATest) [](https://github.com/m0nhawk/grafana_api/blob/master/LICENSE) [](https://codecov.io/gh/m0nhawk/grafana_api/) + +[](https://pypi.org/project/grafana-api/) [](https://anaconda.org/m0nhawk/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: + +```python +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](https://grafana.com/docs/grafana/latest/http_api/admin/) + +```python +# 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](LICENSE)). + + + + +%prep +%autosetup -n grafana-api-1.0.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-grafana-api -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.3-1 +- Package Spec generated @@ -0,0 +1 @@ +385bfb609d787e2e74f3edfb7922f03e grafana_api-1.0.3.tar.gz |