我想从 get 远程图片,并 post 到指定的服务器上。 我通过 python 的代码可以实现,实现如下
import requests
s = requests.session()
r = s.get("https://www.v2ex.com/static/img/[email protected]")
print(r.content)
r1= s.post("http://localhost:8080/", files={
'filename': (
"123.png",
r.content,
'image/png' #测试
)
})
print(r1.status_code)
但是我用 go 的话,获取到 get 的 body 之后,一直 post 不上去,要不就是 io eof,要不就是提示 content-type,即使解决了 content-type 的问题,io eof 也过不了,求各位大神指导。 感谢、感谢、感谢!!!