def get_imageVat_text(self):
'''
增值税发票识别并返回字典格式结果
'''
req = models.VatInvoiceOCRRequest()
req.from_json_string(self.imgget())
resp = self.client.VatInvoiceOCR(req)
return json.loads(resp.to_json_string()) # 正常没问题
def get_imageFlight_text(self):
'''
机票行程单识别并返回字典格式结果
'''
req = models.FlightInvoiceOCRRequest()
print(1)
req.from_json_string(self.imgget())
print(2)
try:
resp = self.client.FlightInvoiceOCR(req)
except TencentCloudSDKException:
print(resp) # 报错报错:UnboundLocalError: local variable 'resp' referenced before assignment
return json.loads(resp.to_json_string())
相似问题