首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >增值税发票识别正常,机票行程单识别失败?

增值税发票识别正常,机票行程单识别失败?

提问于 2020-04-22 19:33:44
回答 2关注 0查看 418

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())

相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档