From 6789f6a29c7960b2dfde1fc5c254e4909cfd1531 Mon Sep 17 00:00:00 2001 From: Anaisdg <dganais@gmail.com> Date: Mon, 13 Apr 2020 15:00:09 -0500 Subject: [PATCH] fixed url variable in full script example --- .../v2.0/reference/api/client-libraries/go.md | 16 +++++++++------- .../reference/api/client-libraries/python.md | 4 +++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/content/influxdb/v2.0/reference/api/client-libraries/go.md b/content/influxdb/v2.0/reference/api/client-libraries/go.md index c8fed88d7..be6ece34f 100644 --- a/content/influxdb/v2.0/reference/api/client-libraries/go.md +++ b/content/influxdb/v2.0/reference/api/client-libraries/go.md @@ -54,11 +54,11 @@ import ( Next, define variables for your InfluxDB [bucket](/v2.0/organizations/buckets/), [organization](/v2.0/organizations/), and [token](/v2.0/security/tokens/). ```go -bucket = "<my-bucket>" -org = "<my-org>" -token = "<my-token>" +bucket := "<my-bucket>" +org := "<my-org>" +token := "<my-token>" //variable to store the url of your local or InfluxDB Cloud instance -url = "<http://localhost:9999>" +url := "<http://localhost:9999>" `` To write data, create the the InfluxDB Go Client and pass in our named parameters: `url` and `token`. @@ -100,8 +100,10 @@ client.Close() bucket := "<my-bucket>" org := "<my-org>" token := "<my-token>" + //variable to store the url of your local or InfluxDB Cloud instance + url := "<http://localhost:9999>" // Create new client with default option for server url authenticate by token - client := influxdb2.NewClient("http://localhost:9999", token) + client := influxdb2.NewClient(url, token) // User blocking write client for writes to desired bucket writeApi := client.WriteApiBlocking(org, bucket) // Create point using full params constructor @@ -171,9 +173,9 @@ The query client sends the Flux query to InfluxDB and returns the results as a F ```go func main() { // Create client - client := influxdb2.NewClient("http://localhost:9999", "my-token") + client := influxdb2.NewClient(url, token) // Get query client - queryApi := client.QueryApi("my-org") + queryApi := client.QueryApi(org) // Get QueryTableResult result, err := queryApi.Query(context.Background(), `from(bucket:"my-bucket")|> range(start: -1h) |> filter(fn: (r) => r._measurement == "stat")`) if err == nil { diff --git a/content/influxdb/v2.0/reference/api/client-libraries/python.md b/content/influxdb/v2.0/reference/api/client-libraries/python.md index 9e4ed75fc..2fe4b2703 100644 --- a/content/influxdb/v2.0/reference/api/client-libraries/python.md +++ b/content/influxdb/v2.0/reference/api/client-libraries/python.md @@ -86,9 +86,11 @@ from influxdb_client.client.write_api import SYNCHRONOUS bucket = "<my-bucket>" org = "<my-org>" token = "<my-token>" +#variable to store the url of your local or InfluxDB Cloud instance +url="<http://localhost:9999>" client = influxdb_client.InfluxDBClient( - url="http://localhost:9999", + url=url, token=token, org=org )