@@ -73,6 +73,31 @@ grafana.organization.create_organization(
73
73
organization = {" name" : " new_organization" })
74
74
```
75
75
76
+ Or using asynchronous code... the interfaces are identical except for the fact that you will handle coroutines (async/await).
77
+
78
+ ``` python
79
+ from grafana_client import AsyncGrafanaApi
80
+ import asyncio
81
+
82
+ async def main ():
83
+ # Connect to Grafana API endpoint using the `GrafanaApi` class
84
+ grafana
= AsyncGrafanaApi.from_url(
" https://username:[email protected] /grafana/" )
85
+
86
+ # Create user
87
+ user = await grafana.admin.create_user({
88
+ " name" : " User" ,
89
+
90
+ " login" : " user" ,
91
+ " password" : " userpassword" ,
92
+ " OrgId" : 1 ,
93
+ })
94
+
95
+ # Change user password
96
+ user = await grafana.admin.change_user_password(2 , " newpassword" )
97
+
98
+ asyncio.run(main())
99
+ ```
100
+
76
101
### Example programs
77
102
78
103
There are complete example programs to get you started within the [ examples
@@ -133,7 +158,7 @@ grafana = GrafanaApi.from_env()
133
158
```
134
159
135
160
Please note that, on top of the specific examples above, the object obtained by
136
- ` credential ` can be an arbitrary ` requests .auth.AuthBase` instance.
161
+ ` credential ` can be an arbitrary ` niquests .auth.AuthBase` instance.
137
162
138
163
## Selecting Organizations
139
164
@@ -166,14 +191,24 @@ scalar `float` value, or as a tuple of `(<read timeout>, <connect timeout>)`.
166
191
167
192
## Proxy
168
193
169
- The underlying ` requests ` library honors the ` HTTP_PROXY ` and ` HTTPS_PROXY `
194
+ The underlying ` niquests ` library honors the ` HTTP_PROXY ` and ` HTTPS_PROXY `
170
195
environment variables. Setting them before invoking an application using
171
196
` grafana-client ` has been confirmed to work. For example:
172
197
```
173
198
export HTTP_PROXY=10.10.1.10:3128
174
199
export HTTPS_PROXY=10.10.1.11:1080
175
200
```
176
201
202
+ ## DNS Resolver
203
+
204
+ ` niquests ` support using a custom DNS resolver, like but not limited, DNS-over-HTTPS, and DNS-over-QUIC.
205
+ You will have to set ` NIQUESTS_DNS_URL ` environment variable. For example:
206
+ ```
207
+ export NIQUESTS_DNS_URL="doh+cloudflare://"
208
+ ```
209
+
210
+ See the [ documentation] ( https://niquests.readthedocs.io/en/latest/user/quickstart.html#set-dns-via-environment ) to learn
211
+ more about accepted URL parameters and protocols.
177
212
178
213
## Details
179
214
0 commit comments