File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
content/shared/influxdb3-admin/tokens Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ The mechanism for providing your token depends on the client you use to interact
10
10
{{% tabs %}}
11
11
[ influxdb3 CLI] ( #influxdb3-cli-auth )
12
12
[ cURL] ( #curl-auth )
13
+ [ Python (requests)] ( #python-auth-requests )
13
14
{{% /tabs %}}
14
15
15
16
{{% tab-content %}}
@@ -63,6 +64,35 @@ Replace `your-token` with your actual InfluxDB 3 token.
63
64
64
65
{{% /tab-content %}}
65
66
67
+ {{% tab-content %}}
68
+
69
+ Use Python with the ` requests ` library to send an authenticated query:
70
+
71
+ {{% code-placeholders "YOUR_TOKEN" %}}
72
+
73
+ ``` python
74
+ import requests
75
+
76
+ url = " http://localhost:8181/api/v3/query_sql"
77
+ headers = {
78
+ " Authorization" : " Bearer YOUR_TOKEN" ,
79
+ " Content-Type" : " application/json"
80
+ }
81
+ data = {
82
+ " db" : " example-db" ,
83
+ " sql" : " SELECT * FROM 'example-table' WHERE time > now() - INTERVAL '10 minutes'"
84
+ }
85
+
86
+ response = requests.post(url, json = data, headers = headers)
87
+ print (response.json())
88
+ ```
89
+
90
+ {{% /code-placeholders %}}
91
+
92
+ Replace ` YOUR_TOKEN ` with your InfluxDB 3 token.
93
+
94
+ {{% /tab-content %}}
95
+
66
96
{{< /tabs-wrapper >}}
67
97
68
98
{{< children hlevel="h2" readmore=true hr=true >}}
You can’t perform that action at this time.
0 commit comments