This starter code calls Sensible extraction APIs and returns structured data from a PDF. You'll need an API key.
To run the code:
- Clone this repo.
- Open a command promt at this cloned directory:
- To install dependencies, run
python -m pip install requests
.
- To install dependencies, run
- Open extract_docs.py in a text editor and specify:
- your API key. Be sure to secure this key before committing.
- the local path to your PDF.
- the name of the doc type that you created in the Sensible app.
- Run
python extract_doc.py
.
To see example data in a response quickly, run extract_doc.py with an example PDF and config:
- Clone this directory, install dependencies, and add your API key (see previous steps).
- Download an example auto insurance quote PDF.
- In the Sensible app:
- Create a doc type, for example,
test_auto_insurance_quote
. - Create a config in the doc type, for example
anyco
. - Paste the example JSON into the left pane of the config editor.
- Publish the config: Publish configuration > Production.
- Create a doc type, for example,
- Open extract_doc.py in a text editor and specify:
- the path to the example PDF you downloaded.
- the name of the doc type you created.
- Run
python extract_doc.py
.