Documentation

http.post() 函数

requests.post()

这个 http/requests 包提供了一个功能齐全的 HTTP 库。我们建议使用 requests.post() 而不是 http.post()

http.post() 向指定的URL发送HTTP POST请求并携带头部和数据,并返回HTTP状态码。

函数类型签名
(url: string, ?data: bytes, ?headers: A) => int where A: Record

有关更多信息,请参见 Function type signatures

参数

网址

(必填) 发送POST请求的URL。

头部信息

要包含在POST请求中的头部。

包含特殊字符的标题键: 将包含特殊字符的标题键用双引号包裹 ("")。

数据

要包括在POST请求中的数据主体。

示例

将最后报告的状态发送到 URL

import "json"
import "http"

lastReported =
    from(bucket: "example-bucket")
        |> range(start: -1m)
        |> filter(fn: (r) => r._measurement == "statuses")
        |> last()
        |> findColumn(fn: (key) => true, column: "_level")

http.post(
    url: "http://myawsomeurl.com/api/notify",
    headers: {Authorization: "Bearer mySuPerSecRetTokEn", "Content-type": "application/json"},
    data: json.encode(v: lastReported[0]),
)


Flux的未来

Flux 正在进入维护模式。您可以像现在一样继续使用它,而无需对您的代码进行任何更改。

阅读更多

InfluxDB 3 开源版本现已公开Alpha测试

InfluxDB 3 Open Source is now available for alpha testing, licensed under MIT or Apache 2 licensing.

我们将发布两个产品作为测试版的一部分。

InfluxDB 3 核心,是我们新的开源产品。 它是一个用于时间序列和事件数据的实时数据引擎。 InfluxDB 3 企业版是建立在核心基础之上的商业版本,增加了历史查询能力、读取副本、高可用性、可扩展性和细粒度安全性。

有关如何开始的更多信息,请查看: