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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么Golang無法下載某些網(wǎng)頁?

為什么Golang無法下載某些網(wǎng)頁?

Go
叮當貓咪 2021-04-10 15:11:23
我想下載幻想足球數(shù)據(jù)以在Go中進行分析,但是當我嘗試從此api頁面下載時,即使代碼適用于其他網(wǎng)站(例如此api頁面),我仍返回一個空響應最小復制,輸出一個空數(shù)組。package mainimport (    "fmt"    "io/ioutil"    "net/http"    "time")const AllPlayerData = "https://fantasy.premierleague.com/drf/bootstrap-static"func main() {    downloadAllData()}func downloadAllData() {    client := &http.Client{        Timeout: 20 * time.Second,    }    response, err := client.Get(AllPlayerData)    if err != nil {        fmt.Println("Unable to download player data.")        return    }    body, err := ioutil.ReadAll(response.Body)    if err != nil {        fmt.Println("Failed to read response")        return    }    defer response.Body.Close()    fmt.Println(body)}相同的網(wǎng)頁在Python中可以正常下載:import requestsurl = "https://fantasy.premierleague.com/drf/bootstrap-static"r = requests.get(url)print(r.content)我認為這與例如Ajax調(diào)用無關(guān),因為在Chrome瀏覽器中查看網(wǎng)絡請求不會超出頁面加載本身
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 282 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

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