Skip to content

Commit 8432982

Browse files
committed
Add basic example program, inquiring play.grafana.org
1 parent 191502d commit 8432982

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
* Make `GrafanaApi(auth=)` an optional argument. This makes it easier to
99
connect to Grafana instances that do not require authentication.
10+
* Add basic example program, inquiring `play.grafana.org`.
1011

1112

1213
## 2.2.1 (2022-05-20)

examples/basic.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import json
2+
import sys
3+
4+
from grafana_client import GrafanaApi
5+
6+
7+
def main():
8+
9+
# Connect to Grafana instance of Grafana Labs fame.
10+
grafana = GrafanaApi(host='play.grafana.org')
11+
12+
print("## All folders on play.grafana.org", file=sys.stderr)
13+
folders = grafana.folder.get_all_folders()
14+
print(json.dumps(folders, indent=2))
15+
16+
# print("## Dashboard with UID 000000012 at play.grafana.org", file=sys.stderr)
17+
# dashboard_000000012 = grafana.dashboard.get_dashboard("000000012")
18+
# print(dashboard_000000012)
19+
20+
21+
if __name__ == "__main__":
22+
main()

0 commit comments

Comments
 (0)