File tree Expand file tree Collapse file tree 1 file changed +1
-28
lines changed
content/shared/influxdb3-admin/tokens Expand file tree Collapse file tree 1 file changed +1
-28
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ 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 )
14
13
{{% /tabs %}}
15
14
16
15
{{% tab-content %}}
@@ -49,42 +48,16 @@ Replace `YOUR_TOKEN` with your authorization token.
49
48
{{% tab-content %}}
50
49
51
50
{{% code-placeholders "AUTH_TOKEN" %}}
52
-
53
51
``` bash
54
52
# Add your token to the HTTP Authorization header
55
53
curl " http://{{< influxdb/host >}}/api/v3/query_sql" \
56
54
--header " Authorization: Bearer AUTH_TOKEN" \
57
55
--data-urlencode " db=example-db" \
58
56
--data-urlencode " q=SELECT * FROM 'example-table' WHERE time > now() - INTERVAL '10 minutes'"
59
-
60
- {{% /tab-content %}}
61
-
62
- {{% tab-content %}}
63
-
64
- Use Python with the ` requests` library to send an authenticated query:
65
-
66
- {{% code-placeholders " YOUR_TOKEN" %}}
67
-
68
- ` ` ` python
69
- import requests
70
-
71
- url = " http://localhost:8181/api/v3/query_sql"
72
- headers = {
73
- " Authorization" : " Bearer YOUR_TOKEN" ,
74
- " Content-Type" : " application/json"
75
- }
76
- data = {
77
- " db" : " example-db" ,
78
- " sql" : " SELECT * FROM 'example-table' WHERE time > now() - INTERVAL '10 minutes'"
79
- }
80
-
81
- response = requests.post(url, json=data, headers=headers)
82
- print(response.json ())
83
57
```
84
-
85
58
{{% /code-placeholders %}}
86
59
87
- Replace ` YOUR_TOKEN ` with your InfluxDB 3 token.
60
+ Replace ` AUTH_TOKEN ` with your actual InfluxDB 3 token.
88
61
89
62
{{% /tab-content %}}
90
63
You can’t perform that action at this time.
0 commit comments