Closed 0000sir closed 4 years ago
直接改成 post 'material/get_material' 会报以下 cannot determine size of body 错误
HTTP::RequestError: cannot determine size of body: {:params=>{:media_id=>"nONZrMG8hS8nglm-8PuJBe7AD_0sUBmKdyWFm7P0Eds"}, :as=>:file}
不知道能如何处理,拼凑curl命令能够勉强使用:
token = Wechat.api.access_token.token
output = Tempfile.new
cmd = "curl \"https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=#{token}\" -d '{\"media_id\":\"#{media_id}\"}' > #{output.path}"
p output.path
system(cmd)
确实变了,已发新版本0.11.8修正。
用Wechat.api.material media_id(永久素材列表获取的media_id)获取媒体文件时总是提示40007,翻代码翻到 common.rb 中
推测调用的url是 material/get,微信文档中 material/get_material 是获取永久素材的接口,且调用方式是post(文档地址 https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Getting_Permanent_Assets.html)
微信改接口了?