with open( 'E:/imooc1.png', 'rb') as f:
image = f.read()
image_base64 = str(base64.b64encode(image), encoding='utf-8')
r = ShowapiRequest("https://route.showapi.com/2360-2","692735","80ec7151d2b14b86b83XXXXXXXa" )
r.addBodyPara("img_base64", image_base64)
r.addBodyPara("typeId", "35")
r.addBodyPara("convert_to_jpg", "0")
#r.addFilePara("image", 'E:/imooc1.png')
res = r.post()
print(res.text) # 返回信息
还是报错:
{
"showapi_res_error": "must input file_base64 field",
"showapi_res_id": "60e1a5fe0de376f151d9234b",
"showapi_res_code": -1,
"showapi_res_body": {}
}