TA的每日心情 | 无聊 2016-12-23 14:05 |
---|
签到天数: 7 天 连续签到: 1 天 [LV.3]偶尔看看II
|
本帖最后由 稻爷的学徒 于 2016-4-8 13:52 编辑
要实现的功能,把一个照片从树莓派传到微信公众平台测试号,使用的是微信的python 的SDK包
微信上面的python 的代码如下:
rjson = wc.media.upload.file(type='image', jpeg = open('/home/pi/test.jpg', 'rb'))
print rjson
content = '{"touser":"or0d6t8VKYQQWQZx3Y5nZIYFLvoY", "msgtype":"image", "image": {"media_id":rjson.media_id}}'
print wc.message.custom.send.post(body=content)
测试反馈的结果如下:那位大哥知道是怎么回事,求助,帮忙,谢谢
Traceback (most recent call last):
File "banding.py", line 31, in <module>
print wc.message.custom.send.post(body=content)
File "/usr/local/lib/python2.7/dist-packages/weixin.py", line 355, in __call__
self._method, self._client.access_token, **kw)
File "/usr/local/lib/python2.7/dist-packages/weixin.py", line 235, in _http_call
return json.read()
File "/usr/local/lib/python2.7/dist-packages/weixin.py", line 183, in read
raise APIError(rjson.errcode, rjson.errmsg)
weixin.APIError: 40007:invalid media_id hint: [__qlCa0082age6]
|
|