iOCR财会票据识别 请求报错
Ta的回复 :# encoding=utf-8 import requests,json,base64 from urllib import quote import os headers = { 'Content-Type': "application/x-www-form-urlencoded", 'cache-control': "no-cache" }; def test_detect_image_vaild(image_path, url): image = open(save_image_path, 'rb'); imageBase64str = base64.b64encode(image.read()).replace("\r", ""); payload = {"detectorId":"0", "image":imageBase64str} response = requests.post(url, data=payload, headers=headers); print(response.text); if __name__ == '__main__': save_image_path = ${image_path}; url = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance" token = ${access_token} test_detect_image_vaild(save_image_path, url + "?access_token=" + token)