第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何使用 REST API 觸發(fā) Airflow Dag

如何使用 REST API 觸發(fā) Airflow Dag

Go
MMTTMM 2022-05-18 16:40:14
我正在嘗試通過關(guān)注https://airflow.apache.org/docs/stable/api.html這個(gè)站點(diǎn)來觸發(fā) Airflow Dags。他們提供了一個(gè) curl 命令curl -X POST \  http://localhost:8080/api/experimental/dags/<DAG_ID>/dag_runs \  -H 'Cache-Control: no-cache' \  -H 'Content-Type: application/json' \  -d '{"conf":"{\"key\":\"value\"}"}'來觸發(fā) Dag。當(dāng)我從我的 Shell 執(zhí)行此命令時(shí),它正在工作。我試圖在 Go 中調(diào)用這個(gè)端點(diǎn)POST /api/experimental/dags/<DAG_ID>/dag_runs,我得到了400 Bad Request如何使用POST /api/experimental/dags/<DAG_ID>/dag_runsashttp.POST()或http.NewRequest()在 Go 中?我試過這個(gè):package mainimport (    "encoding/json"    "fmt"    "net/http"    "strings")func main(){    body := strings.NewReader(`{"conf":"{\"key\":\"value\"}"}`)    req, err := http.NewRequest("POST", "http://localhost:8080/api/experimental/dags/airflow_sample/dag_runs", body)    if err != nil {        fmt.Println(err)    }    req.Header.Set("Cache-Control", "no-cache")    req.Header.Set("Content-Type", "application/json")    resp, err := http.DefaultClient.Do(req)    if err != nil {        fmt.Println(err)    }    fmt.Println(resp)    defer resp.Body.Close()}
查看完整描述

1 回答

?
HUWWW

TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個(gè)贊

我解決了。

在主要功能 -

我變了body := strings.NewReader(`{"conf":"{\"key\":\"value\"}"}`)

對(duì)此body := strings.NewReader(`{}`)

它就像一個(gè)魅力。


查看完整回答
反對(duì) 回復(fù) 2022-05-18
  • 1 回答
  • 0 關(guān)注
  • 103 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)