structocr 1.7.1__tar.gz → 1.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {structocr-1.7.1/structocr.egg-info → structocr-1.8.0}/PKG-INFO +61 -14
- {structocr-1.7.1 → structocr-1.8.0}/README.md +58 -11
- {structocr-1.7.1 → structocr-1.8.0}/setup.py +2 -2
- {structocr-1.7.1 → structocr-1.8.0}/structocr/client.py +18 -0
- structocr-1.8.0/structocr/version.py +1 -0
- {structocr-1.7.1 → structocr-1.8.0/structocr.egg-info}/PKG-INFO +61 -14
- structocr-1.7.1/structocr/version.py +0 -1
- {structocr-1.7.1 → structocr-1.8.0}/LICENSE +0 -0
- {structocr-1.7.1 → structocr-1.8.0}/MANIFEST.in +0 -0
- {structocr-1.7.1 → structocr-1.8.0}/pyproject.toml +0 -0
- {structocr-1.7.1 → structocr-1.8.0}/setup.cfg +0 -0
- {structocr-1.7.1 → structocr-1.8.0}/structocr/__init__.py +0 -0
- {structocr-1.7.1 → structocr-1.8.0}/structocr.egg-info/SOURCES.txt +0 -0
- {structocr-1.7.1 → structocr-1.8.0}/structocr.egg-info/dependency_links.txt +0 -0
- {structocr-1.7.1 → structocr-1.8.0}/structocr.egg-info/requires.txt +0 -0
- {structocr-1.7.1 → structocr-1.8.0}/structocr.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structocr
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 1.8.0
|
|
4
|
+
Summary: Structured OCR API SDK for Python: passports, visas, proof of address, health cards, IDs, driver licenses, auto insurance, VIN Pro, invoices, receipts, and bills of lading.
|
|
5
5
|
Home-page: https://structocr.com
|
|
6
6
|
Author: StructOCR Team
|
|
7
7
|
Author-email: support@structocr.com
|
|
@@ -11,7 +11,7 @@ Project-URL: Documentation, https://structocr.com/developers
|
|
|
11
11
|
Project-URL: Get a free API key, https://structocr.com/register?utm_source=pypi&utm_medium=project_urls&utm_campaign=sdk
|
|
12
12
|
Project-URL: Source, https://github.com/dracula911/structocr-python
|
|
13
13
|
Project-URL: Tracker, https://github.com/dracula911/structocr-python/issues
|
|
14
|
-
Keywords: ocr,passport ocr,mrz,id card ocr,driver license ocr,pdf417,vin ocr,invoice ocr,receipt ocr,kyc,document ai,structocr
|
|
14
|
+
Keywords: ocr,passport ocr,mrz,id card ocr,driver license ocr,pdf417,health card ocr,proof of address ocr,visa ocr,vin ocr,vin pro ocr,auto insurance ocr,invoice ocr,receipt ocr,bill of lading ocr,freight ocr,kyc,document ai,structocr
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: License :: OSI Approved :: MIT License
|
|
17
17
|
Classifier: Operating System :: OS Independent
|
|
@@ -38,17 +38,17 @@ Dynamic: summary
|
|
|
38
38
|
|
|
39
39
|
Official Python client for the [StructOCR API](https://structocr.com/developers?utm_source=pypi&utm_medium=readme&utm_campaign=sdk).
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Extract validated, structured JSON from 19 document types — spanning identity & KYC (passports, travel visas, proof of address, national IDs, driver licenses, PDF417 barcodes, health insurance cards), vehicles & insurance (VIN, VIN Pro vehicle decode, license plates, registrations, auto insurance cards), finance (invoices, receipts), and logistics (bills of lading, shipping containers, weighbridge tickets, ATM cassettes, boat HINs). One method call per document, zero template training.
|
|
42
42
|
|
|
43
43
|
The SDK accepts a local JPG, PNG, WebP, or PDF path, plus in-memory `bytes`. It validates the decoded file locally, converts it to Base64, and sends JSON as `{"img": "..."}`. The REST API also supports multipart uploads; this SDK release keeps Base64 JSON as its default transport for backward compatibility.
|
|
44
44
|
|
|
45
45
|
## Get a free API key
|
|
46
46
|
|
|
47
|
-
1. [Create an account](https://structocr.com/register?utm_source=pypi&utm_medium=readme&utm_campaign=sdk). New accounts get **200 free credits**, enough for 100
|
|
47
|
+
1. [Create an account](https://structocr.com/register?utm_source=pypi&utm_medium=readme&utm_campaign=sdk). New accounts get **200 free credits**, enough for 100 two-credit document scans, and no credit card is needed.
|
|
48
48
|
2. Copy your key from **API Keys** in the dashboard.
|
|
49
|
-
3. Optionally
|
|
49
|
+
3. Optionally test any of the 19 endpoints on a sample image in the [Playground](https://structocr.com/dashboard/playground?utm_source=pypi&utm_medium=readme&utm_campaign=sdk) before you write code.
|
|
50
50
|
|
|
51
|
-
Not ready to sign up? Try
|
|
51
|
+
Not ready to sign up? Try documents directly in your browser on a sample image or your own file, no account needed: use the **Try it** links in the table below.
|
|
52
52
|
|
|
53
53
|
After the free credits, packs start at $5 for 500 credits. There is no subscription and credits do not expire. See [pricing](https://structocr.com/pricing?utm_source=pypi&utm_medium=readme&utm_campaign=sdk).
|
|
54
54
|
|
|
@@ -57,21 +57,38 @@ After the free credits, packs start at $5 for 500 credits. There is no subscript
|
|
|
57
57
|
| Document | Method | Credits per scan | Try it |
|
|
58
58
|
| --- | --- | --- | --- |
|
|
59
59
|
| Passport | `scan_passport` | 2 | [Try it](https://structocr.com/products/passport-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
60
|
-
| National ID card | `scan_national_id` | 2 | [Try it](https://structocr.com/products/national-id-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
61
60
|
| Driver license (front) | `scan_driver_license` | 2 | [Try it](https://structocr.com/products/driver-license-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
62
61
|
| US/Canada driver license PDF417 barcode | `scan_driver_license_pdf417` | 2 | [Try it](https://structocr.com/tools/driver-license-pdf417-scanner?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try) |
|
|
63
|
-
|
|
|
62
|
+
| National ID card | `scan_national_id` | 2 | [Try it](https://structocr.com/products/national-id-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
63
|
+
| Health insurance card *(New)* | `scan_health_card` | 2 | [Try it](https://structocr.com/products/health-card-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
64
|
+
| Proof of Address *(New)* | `scan_proof_of_address` | 2 | [Try it](https://structocr.com/products/proof-of-address-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
65
|
+
| Travel visa (MRV-A/B & eVisa) *(New)* | `scan_visa` | 2 | [Try it](https://structocr.com/products/visa-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
64
66
|
| VIN | `scan_vin` | 1 | [Try it](https://structocr.com/products/vin-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
67
|
+
| VIN Pro (VIN + vehicle details) *(New)* | `scan_vin_pro` | 2 | |
|
|
65
68
|
| License plate | `scan_license_plate` | 1 | [Try it](https://structocr.com/products/license-plate-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
69
|
+
| Vehicle registration | `scan_vehicle_registration` | 2 | [Try it](https://structocr.com/products/vehicle-registration-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
70
|
+
| Auto insurance card *(New)* | `scan_auto_insurance` | 2 | [Try it](https://structocr.com/products/auto-insurance-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
66
71
|
| Invoice | `scan_invoice` | 3 | [Try it](https://structocr.com/products/invoice-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
67
72
|
| Receipt | `scan_receipt` | 1 | [Try it](https://structocr.com/products/receipt-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
68
73
|
| Shipping container (ISO 6346) | `scan_container` | 1 | [Try it](https://structocr.com/products/container-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
74
|
+
| Bill of Lading & freight *(New)* | `scan_bill_of_lading` | 3 | [Try it](https://structocr.com/products/bill-of-lading-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
69
75
|
| Weighbridge ticket | `scan_weighbridge_ticket` | 2 | [Try it](https://structocr.com/products/weighbridge-ticket-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
70
76
|
| ATM cassette | `scan_atm_cassette` | 1 | |
|
|
71
77
|
| HIN (boat hull number) | `scan_hin` | 1 | [Try it](https://structocr.com/products/hin-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
72
78
|
|
|
73
79
|
The receipt endpoint's optional enhanced mode costs 2 credits. Only successful requests are charged.
|
|
74
80
|
|
|
81
|
+
## What's new in v1.8.0
|
|
82
|
+
|
|
83
|
+
Added native SDK methods for all six newly launched StructOCR endpoints:
|
|
84
|
+
|
|
85
|
+
- **`scan_proof_of_address(file)`** (`POST /v1/proof-of-address`, 2 credits) — Utility bills, bank statements, tax notices, and leases with 90/180-day freshness and PO Box checks.
|
|
86
|
+
- **`scan_visa(file)`** (`POST /v1/visa`, 2 credits) — Passport visa stickers (ICAO 9303 MRV-A 2×44 & MRV-B 2×36 check-digit verification) and global eVisa PDFs.
|
|
87
|
+
- **`scan_bill_of_lading(file)`** (`POST /v1/bill-of-lading`, 3 credits) — Ocean/road Bills of Lading, Packing Lists, Air Waybills (IATA Mod-7 validation), Commercial Invoices, and signed PODs with ISO 6346 container checks and cargo weight reconciliation.
|
|
88
|
+
- **`scan_health_card(file)`** (`POST /v1/health-card`, 2 credits) — US health insurance cards (Member ID, Group, RxBIN/RxPCN/RxGRP, copays), GCC/Canada/India/Brazil medical cards, and EU Tessera Sanitaria/EHIC, including 2-page front+back PDFs.
|
|
89
|
+
- **`scan_auto_insurance(file)`** (`POST /v1/auto-insurance`, 2 credits) — US ACORD 50 / state proof of insurance and Canadian Pink Cards with NAIC, policy date, and VIN check-digit validation.
|
|
90
|
+
- **`scan_vin_pro(file)`** (`POST /v1/vin-pro`, 2 credits) — VIN OCR with ISO 3779 check-digit validation plus decoded vehicle year, make, model, trim, engine, and body class.
|
|
91
|
+
|
|
75
92
|
## Install
|
|
76
93
|
|
|
77
94
|
```bash
|
|
@@ -140,15 +157,21 @@ scan_passport(file)
|
|
|
140
157
|
scan_national_id(file)
|
|
141
158
|
scan_driver_license(file)
|
|
142
159
|
scan_driver_license_pdf417(file)
|
|
143
|
-
|
|
144
|
-
|
|
160
|
+
scan_health_card(file)
|
|
161
|
+
scan_proof_of_address(file)
|
|
162
|
+
scan_visa(file)
|
|
145
163
|
scan_vin(file)
|
|
146
|
-
|
|
147
|
-
scan_container(file)
|
|
164
|
+
scan_vin_pro(file)
|
|
148
165
|
scan_license_plate(file)
|
|
149
166
|
scan_vehicle_registration(file)
|
|
150
|
-
|
|
167
|
+
scan_auto_insurance(file)
|
|
168
|
+
scan_invoice(file)
|
|
169
|
+
scan_receipt(file)
|
|
170
|
+
scan_container(file)
|
|
171
|
+
scan_bill_of_lading(file)
|
|
151
172
|
scan_weighbridge_ticket(file)
|
|
173
|
+
scan_atm_cassette(file)
|
|
174
|
+
scan_hin(file)
|
|
152
175
|
get_account_balance()
|
|
153
176
|
```
|
|
154
177
|
|
|
@@ -165,6 +188,30 @@ receipt = client.scan_receipt(
|
|
|
165
188
|
|
|
166
189
|
`response_version=2` remains accepted for compatibility but is not required. Receipt v1 is retired.
|
|
167
190
|
|
|
191
|
+
Proof of Address example:
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
poa = client.scan_proof_of_address("./utility-bill.pdf")
|
|
195
|
+
if poa.get("success"):
|
|
196
|
+
print(poa["data"]["address"], poa["data"]["validation"]["is_within_90_days"])
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Travel Visa example:
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
visa = client.scan_visa("./visa-sticker.jpg")
|
|
203
|
+
if visa.get("success"):
|
|
204
|
+
print(visa["data"]["visa_number"], visa["data"]["validation"]["mrz_checksum_valid"])
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Bill of Lading & freight example:
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
bol = client.scan_bill_of_lading("./bill-of-lading.pdf")
|
|
211
|
+
if bol.get("success"):
|
|
212
|
+
print(bol["data"]["document_type"], bol["data"]["containers"], bol["data"]["validation"])
|
|
213
|
+
```
|
|
214
|
+
|
|
168
215
|
US driver license PDF417 example:
|
|
169
216
|
|
|
170
217
|
```python
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Official Python client for the [StructOCR API](https://structocr.com/developers?utm_source=pypi&utm_medium=readme&utm_campaign=sdk).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Extract validated, structured JSON from 19 document types — spanning identity & KYC (passports, travel visas, proof of address, national IDs, driver licenses, PDF417 barcodes, health insurance cards), vehicles & insurance (VIN, VIN Pro vehicle decode, license plates, registrations, auto insurance cards), finance (invoices, receipts), and logistics (bills of lading, shipping containers, weighbridge tickets, ATM cassettes, boat HINs). One method call per document, zero template training.
|
|
6
6
|
|
|
7
7
|
The SDK accepts a local JPG, PNG, WebP, or PDF path, plus in-memory `bytes`. It validates the decoded file locally, converts it to Base64, and sends JSON as `{"img": "..."}`. The REST API also supports multipart uploads; this SDK release keeps Base64 JSON as its default transport for backward compatibility.
|
|
8
8
|
|
|
9
9
|
## Get a free API key
|
|
10
10
|
|
|
11
|
-
1. [Create an account](https://structocr.com/register?utm_source=pypi&utm_medium=readme&utm_campaign=sdk). New accounts get **200 free credits**, enough for 100
|
|
11
|
+
1. [Create an account](https://structocr.com/register?utm_source=pypi&utm_medium=readme&utm_campaign=sdk). New accounts get **200 free credits**, enough for 100 two-credit document scans, and no credit card is needed.
|
|
12
12
|
2. Copy your key from **API Keys** in the dashboard.
|
|
13
|
-
3. Optionally
|
|
13
|
+
3. Optionally test any of the 19 endpoints on a sample image in the [Playground](https://structocr.com/dashboard/playground?utm_source=pypi&utm_medium=readme&utm_campaign=sdk) before you write code.
|
|
14
14
|
|
|
15
|
-
Not ready to sign up? Try
|
|
15
|
+
Not ready to sign up? Try documents directly in your browser on a sample image or your own file, no account needed: use the **Try it** links in the table below.
|
|
16
16
|
|
|
17
17
|
After the free credits, packs start at $5 for 500 credits. There is no subscription and credits do not expire. See [pricing](https://structocr.com/pricing?utm_source=pypi&utm_medium=readme&utm_campaign=sdk).
|
|
18
18
|
|
|
@@ -21,21 +21,38 @@ After the free credits, packs start at $5 for 500 credits. There is no subscript
|
|
|
21
21
|
| Document | Method | Credits per scan | Try it |
|
|
22
22
|
| --- | --- | --- | --- |
|
|
23
23
|
| Passport | `scan_passport` | 2 | [Try it](https://structocr.com/products/passport-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
24
|
-
| National ID card | `scan_national_id` | 2 | [Try it](https://structocr.com/products/national-id-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
25
24
|
| Driver license (front) | `scan_driver_license` | 2 | [Try it](https://structocr.com/products/driver-license-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
26
25
|
| US/Canada driver license PDF417 barcode | `scan_driver_license_pdf417` | 2 | [Try it](https://structocr.com/tools/driver-license-pdf417-scanner?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try) |
|
|
27
|
-
|
|
|
26
|
+
| National ID card | `scan_national_id` | 2 | [Try it](https://structocr.com/products/national-id-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
27
|
+
| Health insurance card *(New)* | `scan_health_card` | 2 | [Try it](https://structocr.com/products/health-card-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
28
|
+
| Proof of Address *(New)* | `scan_proof_of_address` | 2 | [Try it](https://structocr.com/products/proof-of-address-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
29
|
+
| Travel visa (MRV-A/B & eVisa) *(New)* | `scan_visa` | 2 | [Try it](https://structocr.com/products/visa-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
28
30
|
| VIN | `scan_vin` | 1 | [Try it](https://structocr.com/products/vin-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
31
|
+
| VIN Pro (VIN + vehicle details) *(New)* | `scan_vin_pro` | 2 | |
|
|
29
32
|
| License plate | `scan_license_plate` | 1 | [Try it](https://structocr.com/products/license-plate-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
33
|
+
| Vehicle registration | `scan_vehicle_registration` | 2 | [Try it](https://structocr.com/products/vehicle-registration-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
34
|
+
| Auto insurance card *(New)* | `scan_auto_insurance` | 2 | [Try it](https://structocr.com/products/auto-insurance-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
30
35
|
| Invoice | `scan_invoice` | 3 | [Try it](https://structocr.com/products/invoice-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
31
36
|
| Receipt | `scan_receipt` | 1 | [Try it](https://structocr.com/products/receipt-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
32
37
|
| Shipping container (ISO 6346) | `scan_container` | 1 | [Try it](https://structocr.com/products/container-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
38
|
+
| Bill of Lading & freight *(New)* | `scan_bill_of_lading` | 3 | [Try it](https://structocr.com/products/bill-of-lading-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
33
39
|
| Weighbridge ticket | `scan_weighbridge_ticket` | 2 | [Try it](https://structocr.com/products/weighbridge-ticket-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
34
40
|
| ATM cassette | `scan_atm_cassette` | 1 | |
|
|
35
41
|
| HIN (boat hull number) | `scan_hin` | 1 | [Try it](https://structocr.com/products/hin-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
36
42
|
|
|
37
43
|
The receipt endpoint's optional enhanced mode costs 2 credits. Only successful requests are charged.
|
|
38
44
|
|
|
45
|
+
## What's new in v1.8.0
|
|
46
|
+
|
|
47
|
+
Added native SDK methods for all six newly launched StructOCR endpoints:
|
|
48
|
+
|
|
49
|
+
- **`scan_proof_of_address(file)`** (`POST /v1/proof-of-address`, 2 credits) — Utility bills, bank statements, tax notices, and leases with 90/180-day freshness and PO Box checks.
|
|
50
|
+
- **`scan_visa(file)`** (`POST /v1/visa`, 2 credits) — Passport visa stickers (ICAO 9303 MRV-A 2×44 & MRV-B 2×36 check-digit verification) and global eVisa PDFs.
|
|
51
|
+
- **`scan_bill_of_lading(file)`** (`POST /v1/bill-of-lading`, 3 credits) — Ocean/road Bills of Lading, Packing Lists, Air Waybills (IATA Mod-7 validation), Commercial Invoices, and signed PODs with ISO 6346 container checks and cargo weight reconciliation.
|
|
52
|
+
- **`scan_health_card(file)`** (`POST /v1/health-card`, 2 credits) — US health insurance cards (Member ID, Group, RxBIN/RxPCN/RxGRP, copays), GCC/Canada/India/Brazil medical cards, and EU Tessera Sanitaria/EHIC, including 2-page front+back PDFs.
|
|
53
|
+
- **`scan_auto_insurance(file)`** (`POST /v1/auto-insurance`, 2 credits) — US ACORD 50 / state proof of insurance and Canadian Pink Cards with NAIC, policy date, and VIN check-digit validation.
|
|
54
|
+
- **`scan_vin_pro(file)`** (`POST /v1/vin-pro`, 2 credits) — VIN OCR with ISO 3779 check-digit validation plus decoded vehicle year, make, model, trim, engine, and body class.
|
|
55
|
+
|
|
39
56
|
## Install
|
|
40
57
|
|
|
41
58
|
```bash
|
|
@@ -104,15 +121,21 @@ scan_passport(file)
|
|
|
104
121
|
scan_national_id(file)
|
|
105
122
|
scan_driver_license(file)
|
|
106
123
|
scan_driver_license_pdf417(file)
|
|
107
|
-
|
|
108
|
-
|
|
124
|
+
scan_health_card(file)
|
|
125
|
+
scan_proof_of_address(file)
|
|
126
|
+
scan_visa(file)
|
|
109
127
|
scan_vin(file)
|
|
110
|
-
|
|
111
|
-
scan_container(file)
|
|
128
|
+
scan_vin_pro(file)
|
|
112
129
|
scan_license_plate(file)
|
|
113
130
|
scan_vehicle_registration(file)
|
|
114
|
-
|
|
131
|
+
scan_auto_insurance(file)
|
|
132
|
+
scan_invoice(file)
|
|
133
|
+
scan_receipt(file)
|
|
134
|
+
scan_container(file)
|
|
135
|
+
scan_bill_of_lading(file)
|
|
115
136
|
scan_weighbridge_ticket(file)
|
|
137
|
+
scan_atm_cassette(file)
|
|
138
|
+
scan_hin(file)
|
|
116
139
|
get_account_balance()
|
|
117
140
|
```
|
|
118
141
|
|
|
@@ -129,6 +152,30 @@ receipt = client.scan_receipt(
|
|
|
129
152
|
|
|
130
153
|
`response_version=2` remains accepted for compatibility but is not required. Receipt v1 is retired.
|
|
131
154
|
|
|
155
|
+
Proof of Address example:
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
poa = client.scan_proof_of_address("./utility-bill.pdf")
|
|
159
|
+
if poa.get("success"):
|
|
160
|
+
print(poa["data"]["address"], poa["data"]["validation"]["is_within_90_days"])
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Travel Visa example:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
visa = client.scan_visa("./visa-sticker.jpg")
|
|
167
|
+
if visa.get("success"):
|
|
168
|
+
print(visa["data"]["visa_number"], visa["data"]["validation"]["mrz_checksum_valid"])
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Bill of Lading & freight example:
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
bol = client.scan_bill_of_lading("./bill-of-lading.pdf")
|
|
175
|
+
if bol.get("success"):
|
|
176
|
+
print(bol["data"]["document_type"], bol["data"]["containers"], bol["data"]["validation"])
|
|
177
|
+
```
|
|
178
|
+
|
|
132
179
|
US driver license PDF417 example:
|
|
133
180
|
|
|
134
181
|
```python
|
|
@@ -9,8 +9,8 @@ exec((ROOT / "structocr" / "version.py").read_text(encoding="utf-8"), VERSION)
|
|
|
9
9
|
setup(
|
|
10
10
|
name="structocr",
|
|
11
11
|
version=VERSION["__version__"],
|
|
12
|
-
description="
|
|
13
|
-
keywords=["ocr", "passport ocr", "mrz", "id card ocr", "driver license ocr", "pdf417", "vin ocr", "invoice ocr", "receipt ocr", "kyc", "document ai", "structocr"],
|
|
12
|
+
description="Structured OCR API SDK for Python: passports, visas, proof of address, health cards, IDs, driver licenses, auto insurance, VIN Pro, invoices, receipts, and bills of lading.",
|
|
13
|
+
keywords=["ocr", "passport ocr", "mrz", "id card ocr", "driver license ocr", "pdf417", "health card ocr", "proof of address ocr", "visa ocr", "vin ocr", "vin pro ocr", "auto insurance ocr", "invoice ocr", "receipt ocr", "bill of lading ocr", "freight ocr", "kyc", "document ai", "structocr"],
|
|
14
14
|
long_description=(ROOT / "README.md").read_text(encoding="utf-8"),
|
|
15
15
|
long_description_content_type="text/markdown",
|
|
16
16
|
license="MIT",
|
|
@@ -191,15 +191,30 @@ class StructOCR:
|
|
|
191
191
|
def scan_driver_license_pdf417(self, file: FileInput) -> Dict[str, Any]:
|
|
192
192
|
return self._post_image("driver-license-pdf417", file, allow_pdf=False)
|
|
193
193
|
|
|
194
|
+
def scan_health_card(self, file: FileInput) -> Dict[str, Any]:
|
|
195
|
+
return self._post_image("health-card", file)
|
|
196
|
+
|
|
197
|
+
def scan_proof_of_address(self, file: FileInput) -> Dict[str, Any]:
|
|
198
|
+
return self._post_image("proof-of-address", file)
|
|
199
|
+
|
|
200
|
+
def scan_visa(self, file: FileInput) -> Dict[str, Any]:
|
|
201
|
+
return self._post_image("visa", file)
|
|
202
|
+
|
|
194
203
|
def scan_invoice(self, file: FileInput) -> Dict[str, Any]:
|
|
195
204
|
return self._post_image("invoice", file)
|
|
196
205
|
|
|
197
206
|
def scan_vin(self, file: FileInput) -> Dict[str, Any]:
|
|
198
207
|
return self._post_image("vin", file)
|
|
199
208
|
|
|
209
|
+
def scan_vin_pro(self, file: FileInput) -> Dict[str, Any]:
|
|
210
|
+
return self._post_image("vin-pro", file)
|
|
211
|
+
|
|
200
212
|
def scan_container(self, file: FileInput) -> Dict[str, Any]:
|
|
201
213
|
return self._post_image("container", file)
|
|
202
214
|
|
|
215
|
+
def scan_bill_of_lading(self, file: FileInput) -> Dict[str, Any]:
|
|
216
|
+
return self._post_image("bill-of-lading", file)
|
|
217
|
+
|
|
203
218
|
def scan_hin(self, file: FileInput) -> Dict[str, Any]:
|
|
204
219
|
return self._post_image("hin", file)
|
|
205
220
|
|
|
@@ -238,6 +253,9 @@ class StructOCR:
|
|
|
238
253
|
def scan_vehicle_registration(self, file: FileInput) -> Dict[str, Any]:
|
|
239
254
|
return self._post_image("vehicle-registration", file)
|
|
240
255
|
|
|
256
|
+
def scan_auto_insurance(self, file: FileInput) -> Dict[str, Any]:
|
|
257
|
+
return self._post_image("auto-insurance", file)
|
|
258
|
+
|
|
241
259
|
def scan_atm_cassette(self, file: FileInput) -> Dict[str, Any]:
|
|
242
260
|
return self._post_image("atm-cassette", file)
|
|
243
261
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.8.0"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structocr
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 1.8.0
|
|
4
|
+
Summary: Structured OCR API SDK for Python: passports, visas, proof of address, health cards, IDs, driver licenses, auto insurance, VIN Pro, invoices, receipts, and bills of lading.
|
|
5
5
|
Home-page: https://structocr.com
|
|
6
6
|
Author: StructOCR Team
|
|
7
7
|
Author-email: support@structocr.com
|
|
@@ -11,7 +11,7 @@ Project-URL: Documentation, https://structocr.com/developers
|
|
|
11
11
|
Project-URL: Get a free API key, https://structocr.com/register?utm_source=pypi&utm_medium=project_urls&utm_campaign=sdk
|
|
12
12
|
Project-URL: Source, https://github.com/dracula911/structocr-python
|
|
13
13
|
Project-URL: Tracker, https://github.com/dracula911/structocr-python/issues
|
|
14
|
-
Keywords: ocr,passport ocr,mrz,id card ocr,driver license ocr,pdf417,vin ocr,invoice ocr,receipt ocr,kyc,document ai,structocr
|
|
14
|
+
Keywords: ocr,passport ocr,mrz,id card ocr,driver license ocr,pdf417,health card ocr,proof of address ocr,visa ocr,vin ocr,vin pro ocr,auto insurance ocr,invoice ocr,receipt ocr,bill of lading ocr,freight ocr,kyc,document ai,structocr
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: License :: OSI Approved :: MIT License
|
|
17
17
|
Classifier: Operating System :: OS Independent
|
|
@@ -38,17 +38,17 @@ Dynamic: summary
|
|
|
38
38
|
|
|
39
39
|
Official Python client for the [StructOCR API](https://structocr.com/developers?utm_source=pypi&utm_medium=readme&utm_campaign=sdk).
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Extract validated, structured JSON from 19 document types — spanning identity & KYC (passports, travel visas, proof of address, national IDs, driver licenses, PDF417 barcodes, health insurance cards), vehicles & insurance (VIN, VIN Pro vehicle decode, license plates, registrations, auto insurance cards), finance (invoices, receipts), and logistics (bills of lading, shipping containers, weighbridge tickets, ATM cassettes, boat HINs). One method call per document, zero template training.
|
|
42
42
|
|
|
43
43
|
The SDK accepts a local JPG, PNG, WebP, or PDF path, plus in-memory `bytes`. It validates the decoded file locally, converts it to Base64, and sends JSON as `{"img": "..."}`. The REST API also supports multipart uploads; this SDK release keeps Base64 JSON as its default transport for backward compatibility.
|
|
44
44
|
|
|
45
45
|
## Get a free API key
|
|
46
46
|
|
|
47
|
-
1. [Create an account](https://structocr.com/register?utm_source=pypi&utm_medium=readme&utm_campaign=sdk). New accounts get **200 free credits**, enough for 100
|
|
47
|
+
1. [Create an account](https://structocr.com/register?utm_source=pypi&utm_medium=readme&utm_campaign=sdk). New accounts get **200 free credits**, enough for 100 two-credit document scans, and no credit card is needed.
|
|
48
48
|
2. Copy your key from **API Keys** in the dashboard.
|
|
49
|
-
3. Optionally
|
|
49
|
+
3. Optionally test any of the 19 endpoints on a sample image in the [Playground](https://structocr.com/dashboard/playground?utm_source=pypi&utm_medium=readme&utm_campaign=sdk) before you write code.
|
|
50
50
|
|
|
51
|
-
Not ready to sign up? Try
|
|
51
|
+
Not ready to sign up? Try documents directly in your browser on a sample image or your own file, no account needed: use the **Try it** links in the table below.
|
|
52
52
|
|
|
53
53
|
After the free credits, packs start at $5 for 500 credits. There is no subscription and credits do not expire. See [pricing](https://structocr.com/pricing?utm_source=pypi&utm_medium=readme&utm_campaign=sdk).
|
|
54
54
|
|
|
@@ -57,21 +57,38 @@ After the free credits, packs start at $5 for 500 credits. There is no subscript
|
|
|
57
57
|
| Document | Method | Credits per scan | Try it |
|
|
58
58
|
| --- | --- | --- | --- |
|
|
59
59
|
| Passport | `scan_passport` | 2 | [Try it](https://structocr.com/products/passport-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
60
|
-
| National ID card | `scan_national_id` | 2 | [Try it](https://structocr.com/products/national-id-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
61
60
|
| Driver license (front) | `scan_driver_license` | 2 | [Try it](https://structocr.com/products/driver-license-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
62
61
|
| US/Canada driver license PDF417 barcode | `scan_driver_license_pdf417` | 2 | [Try it](https://structocr.com/tools/driver-license-pdf417-scanner?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try) |
|
|
63
|
-
|
|
|
62
|
+
| National ID card | `scan_national_id` | 2 | [Try it](https://structocr.com/products/national-id-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
63
|
+
| Health insurance card *(New)* | `scan_health_card` | 2 | [Try it](https://structocr.com/products/health-card-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
64
|
+
| Proof of Address *(New)* | `scan_proof_of_address` | 2 | [Try it](https://structocr.com/products/proof-of-address-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
65
|
+
| Travel visa (MRV-A/B & eVisa) *(New)* | `scan_visa` | 2 | [Try it](https://structocr.com/products/visa-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
64
66
|
| VIN | `scan_vin` | 1 | [Try it](https://structocr.com/products/vin-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
67
|
+
| VIN Pro (VIN + vehicle details) *(New)* | `scan_vin_pro` | 2 | |
|
|
65
68
|
| License plate | `scan_license_plate` | 1 | [Try it](https://structocr.com/products/license-plate-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
69
|
+
| Vehicle registration | `scan_vehicle_registration` | 2 | [Try it](https://structocr.com/products/vehicle-registration-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
70
|
+
| Auto insurance card *(New)* | `scan_auto_insurance` | 2 | [Try it](https://structocr.com/products/auto-insurance-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
66
71
|
| Invoice | `scan_invoice` | 3 | [Try it](https://structocr.com/products/invoice-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
67
72
|
| Receipt | `scan_receipt` | 1 | [Try it](https://structocr.com/products/receipt-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
68
73
|
| Shipping container (ISO 6346) | `scan_container` | 1 | [Try it](https://structocr.com/products/container-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
74
|
+
| Bill of Lading & freight *(New)* | `scan_bill_of_lading` | 3 | [Try it](https://structocr.com/products/bill-of-lading-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
69
75
|
| Weighbridge ticket | `scan_weighbridge_ticket` | 2 | [Try it](https://structocr.com/products/weighbridge-ticket-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
70
76
|
| ATM cassette | `scan_atm_cassette` | 1 | |
|
|
71
77
|
| HIN (boat hull number) | `scan_hin` | 1 | [Try it](https://structocr.com/products/hin-ocr?utm_source=pypi&utm_medium=readme&utm_campaign=sdk_try#live-demo) |
|
|
72
78
|
|
|
73
79
|
The receipt endpoint's optional enhanced mode costs 2 credits. Only successful requests are charged.
|
|
74
80
|
|
|
81
|
+
## What's new in v1.8.0
|
|
82
|
+
|
|
83
|
+
Added native SDK methods for all six newly launched StructOCR endpoints:
|
|
84
|
+
|
|
85
|
+
- **`scan_proof_of_address(file)`** (`POST /v1/proof-of-address`, 2 credits) — Utility bills, bank statements, tax notices, and leases with 90/180-day freshness and PO Box checks.
|
|
86
|
+
- **`scan_visa(file)`** (`POST /v1/visa`, 2 credits) — Passport visa stickers (ICAO 9303 MRV-A 2×44 & MRV-B 2×36 check-digit verification) and global eVisa PDFs.
|
|
87
|
+
- **`scan_bill_of_lading(file)`** (`POST /v1/bill-of-lading`, 3 credits) — Ocean/road Bills of Lading, Packing Lists, Air Waybills (IATA Mod-7 validation), Commercial Invoices, and signed PODs with ISO 6346 container checks and cargo weight reconciliation.
|
|
88
|
+
- **`scan_health_card(file)`** (`POST /v1/health-card`, 2 credits) — US health insurance cards (Member ID, Group, RxBIN/RxPCN/RxGRP, copays), GCC/Canada/India/Brazil medical cards, and EU Tessera Sanitaria/EHIC, including 2-page front+back PDFs.
|
|
89
|
+
- **`scan_auto_insurance(file)`** (`POST /v1/auto-insurance`, 2 credits) — US ACORD 50 / state proof of insurance and Canadian Pink Cards with NAIC, policy date, and VIN check-digit validation.
|
|
90
|
+
- **`scan_vin_pro(file)`** (`POST /v1/vin-pro`, 2 credits) — VIN OCR with ISO 3779 check-digit validation plus decoded vehicle year, make, model, trim, engine, and body class.
|
|
91
|
+
|
|
75
92
|
## Install
|
|
76
93
|
|
|
77
94
|
```bash
|
|
@@ -140,15 +157,21 @@ scan_passport(file)
|
|
|
140
157
|
scan_national_id(file)
|
|
141
158
|
scan_driver_license(file)
|
|
142
159
|
scan_driver_license_pdf417(file)
|
|
143
|
-
|
|
144
|
-
|
|
160
|
+
scan_health_card(file)
|
|
161
|
+
scan_proof_of_address(file)
|
|
162
|
+
scan_visa(file)
|
|
145
163
|
scan_vin(file)
|
|
146
|
-
|
|
147
|
-
scan_container(file)
|
|
164
|
+
scan_vin_pro(file)
|
|
148
165
|
scan_license_plate(file)
|
|
149
166
|
scan_vehicle_registration(file)
|
|
150
|
-
|
|
167
|
+
scan_auto_insurance(file)
|
|
168
|
+
scan_invoice(file)
|
|
169
|
+
scan_receipt(file)
|
|
170
|
+
scan_container(file)
|
|
171
|
+
scan_bill_of_lading(file)
|
|
151
172
|
scan_weighbridge_ticket(file)
|
|
173
|
+
scan_atm_cassette(file)
|
|
174
|
+
scan_hin(file)
|
|
152
175
|
get_account_balance()
|
|
153
176
|
```
|
|
154
177
|
|
|
@@ -165,6 +188,30 @@ receipt = client.scan_receipt(
|
|
|
165
188
|
|
|
166
189
|
`response_version=2` remains accepted for compatibility but is not required. Receipt v1 is retired.
|
|
167
190
|
|
|
191
|
+
Proof of Address example:
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
poa = client.scan_proof_of_address("./utility-bill.pdf")
|
|
195
|
+
if poa.get("success"):
|
|
196
|
+
print(poa["data"]["address"], poa["data"]["validation"]["is_within_90_days"])
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Travel Visa example:
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
visa = client.scan_visa("./visa-sticker.jpg")
|
|
203
|
+
if visa.get("success"):
|
|
204
|
+
print(visa["data"]["visa_number"], visa["data"]["validation"]["mrz_checksum_valid"])
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Bill of Lading & freight example:
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
bol = client.scan_bill_of_lading("./bill-of-lading.pdf")
|
|
211
|
+
if bol.get("success"):
|
|
212
|
+
print(bol["data"]["document_type"], bol["data"]["containers"], bol["data"]["validation"])
|
|
213
|
+
```
|
|
214
|
+
|
|
168
215
|
US driver license PDF417 example:
|
|
169
216
|
|
|
170
217
|
```python
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.7.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|