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

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

Golang Twitter API - update_profile_banner 圖片壓縮錯(cuò)誤

Golang Twitter API - update_profile_banner 圖片壓縮錯(cuò)誤

Go
慕勒3428872 2023-01-03 14:10:12
我正在嘗試使用Twitter API 中的account/update_profile_banner.json更新橫幅圖像。在查詢參數(shù)中,據(jù)說(shuō)圖像可以以 2 種格式類(lèi)型發(fā)送。作為 base64 或原始數(shù)據(jù)。當(dāng)我用 base64 編碼我的圖像時(shí),我認(rèn)為它的大小超過(guò)了最大 http 長(zhǎng)度。以二進(jìn)制形式發(fā)送似乎更不合邏輯,因?yàn)樗?base64 更長(zhǎng)。Post "https://api.twitter.com/1.1/account/update_profile_banner.json?banner=%2F9j%2F2wCEAA...": http2: server sent GOAWAY and closed the connection; LastStreamID=7, ErrCode=COMPRESSION_ERROR, debug=""我使用的庫(kù)是dghubble/go-twitter,但我不得不創(chuàng)建一個(gè)分支,因?yàn)闆](méi)有更新個(gè)人資料橫幅的方法。我將以下函數(shù)和結(jié)構(gòu)添加到 accounts.go 文件中。type AccountUpdateProfileBannerPhotoParams struct {    Banner string `url:"banner,omitempty"`    Width   int    `url:"width,omitempty"`    Height  int    `url:"height,omitempty"`    OffsetX int    `url:"offset_left,omitempty"`    OffsetY int    `url:"offset_top,omitempty"`}func (s *AccountService) UpdateProfileBannerPhoto(params *AccountUpdateProfileBannerPhotoParams) (*User, *http.Response, error) {    user := new(User)    apiError := new(APIError)    resp, err := s.sling.New().Post("update_profile_banner.json").QueryStruct(params).Receive(user, apiError)    return user, resp, relevantError(err, *apiError)}該UpdateProfileBannerPhoto()函數(shù)返回上述錯(cuò)誤消息。
查看完整描述

1 回答

?
慕尼黑的夜晚無(wú)繁華

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

解決了問(wèn)題。疏忽!


我了解到Twitter使用media/upload方法,然后通過(guò)跟蹤網(wǎng)絡(luò)流量media_id將其發(fā)送到account/update_profile_banner方法來(lái)更新值。


但這不是必需的。我更新了QueryStruct函數(shù)UpdateProfileBannerPhoto中BodyForm的,問(wèn)題解決了......


固定的:


func (s *AccountService) UpdateProfileBannerPhoto(params *AccountUpdateProfileBannerPhotoParams) (*User, *http.Response, error) {

    user := new(User)

    apiError := new(APIError)

    resp, err := s.sling.New().Post("update_profile_banner.json").BodyForm(params).Receive(user, apiError)

    return user, resp, relevantError(err, *apiError)

}


查看完整回答
反對(duì) 回復(fù) 2023-01-03
  • 1 回答
  • 0 關(guān)注
  • 139 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(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)