【发布时间】:2020-01-15 07:21:59
【问题描述】:
是否有人使用 python 通过 API 向 Etsy 添加列表? 我正在使用requests_oauthlib,但是想将图像上传到列表时不断出错。其他功能,如列表创建等。图片上传代码:
self.oauth = OAuth1(self.api_key,
client_secret=self.api_secret,
resource_owner_key=self.oauth_token,
resource_owner_secret=self.oauth_token_secret)
def upload_picture(self):
url = "https://openapi.etsy.com/v2/listings/{listing_id}/images"
headers = {
"Content-Type": "multipart/form-data",
}
request = {
'image': ('img8.jpg', open('./img8.jpg', 'rb'), 'image/jpeg'),
}
r = requests.post(url=url, params=request, auth=self.oauth, headers=headers)
print(r.content)
错误:
oauth_problem=signature_invalid
提前致谢!
【问题讨论】:
-
这个问题解决了吗?
-
不,从来都不是……
-
您必须使用 files=files 上传,还有另一个关于它的 SO 问题
-
能否给个链接?
标签: python image oauth multipart etsy