python的mindeeapi帮助程序库

mindee的Python项目详细描述


python的mindeeapi帮助程序库

完整的文档可用here

安装

使用pip从PyPi安装,pip是Python的包管理器。在

pip install mindee

没有安装pip吗?通过从命令行运行以下命令,尝试安装它:

^{pr2}$

开始使用mindeeapi非常容易。创建一个客户,你就可以开始了。在

创建客户机

在mindee客户需要你的API凭据。您可以直接将它们传递给构造函数(请参阅下面的代码)或通过环境变量。在

根据要解析的文档类型,需要为每个端点添加特定的身份验证令牌。在

frommindeeimportClientmindee_client=Client(expense_receipts_token="your_expense_receipts_api_token_here",invoice_token="your_invoice_api_token_here",passport_token="your_passport_api_token_here",license_plate_token="your_license_plate_api_token_here",raise_on_error=True)

我们建议将凭据存储为环境变量。为什么?你不必担心提交你的证书,不小心把它们张贴在公共场所。在

解析方法

# Call the receipt parsing API and create a receipt object under parsed_data.receiptparsed_data=mindee_client.parse_receipt("/path/to/file")# Call the invoice parsing API and create an invoice object under parsed_data.invoiceparsed_data=mindee_client.parse_invoice("/path/to/file")# If you have a mixed data flow of invoice and receipt, use financial_document class# Call the invoice or receipt parsing API according to your input data type# and create a FinancialDocument object under parsed_data.financial_documentparsed_data=mindee_client.parse_financial_document("/path/to/file")# Call the passport parsing API and create a Passport object under parsed_data.passportparsed_data=mindee_client.parse_passport("/path/to/file")# Call the license_plates parsing API and create a CarPlate object under parsed_data.license_plateparsed_data=mindee_client.parse_license_plate("/path/to/file")

输入数据

可以通过三种方式传递输入文件:

从文件路径

receipt_data=mindee_client.parse_receipt('/path/to/file',input_type="path")

从文件对象

withopen('/path/to/file','rb')asfp:receipt_data=mindee_client.parse_receipt(fp,input_type="file")

从垒64开始

receipt_data=mindee_client.parse_receipt(base64_string,input_type="base64")

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Selenium中弹出的java句柄窗口   java将格式化消息从任何片段传递到活动   java如何从int类型的方法返回多个整数   servlets数据不会使用java类和bean插入数据库   java如何修改Solr给出的搜索结果页面?   java如何在wildfly中重定向应用程序路径?   java使用Apache异步HTTP客户端从InputStream构造多部分请求   java解析来自REST的压缩输入流   java上载文件失败,原因是Vaadin Spring PlupLocaddon   使用需要CSRF令牌的旧端点的javascript   java如何在viewpager应用程序中将图像设置为墙纸?   java Axis2与SharePoint 2013(ADFS/FedAuth cookie)   java H2选择:意外的类型39映射   Docker Composition中拒绝java Spring应用程序连接   使用Java的ibm mq ibm mq获取LGETTIME   java循环逻辑中的漏洞   javaspringcom。mongodb。util。JSONParseException   方法调用“振动”可能会产生java。更新到Android Studio 3后出现lang.NullPointerException警告   datetime如何将日历的时间与java进行比较。sql。时间物体?