使用 python 请求OCR识别,报错如下:
{'message': 'invalid request: parsing error - check content-type and body', 'data': {}, 'httpcode': 400, 'code': 3}
代码部分如下:
requrl = 'http://recognition.image.myqcloud.com/ocr/general'
headers = {
'host': 'recognition.image.myqcloud.com',
'authorization': self._auth.get_sign(self._bucket),
'content-type': 'application/json',
}
files = {
'appid': self._auth._appid,
'bucket': self._bucket,
}
files['image'] = picture
return Http.post(requrl, headers=headers, data=files, timeout=self._conf.timeout())
这个是什么问题: headers字典的键值尝试过 'Host'、'Content-Type'等大写开头,错误相同。
相似问题