@@ -106,16 +106,68 @@ for field_name, field_values in result.document.fields.items():
106106 print (field_name, " =" , field_values)
107107```
108108
109+ ### Enqueue and Parse a Webhook Response
110+ This is an optional way of handling asynchronous APIs.
111+
112+ ``` python
113+
114+ ```
115+
109116### Additional Options
110117Options to pass when sending a file.
118+ ``` python
119+ from mindee import Client, product
120+ from mindee.client import LocalResponse
121+
122+ # Init a new client
123+ mindee_client = Client()
124+
125+ # Load a file from disk
126+ input_source = mindee_client.source_from_path(" /path/to/the/file.ext" )
127+
128+ # Parse the file
129+
130+ enqueue_response = mindee_client.enqueue(
131+ product.InternationalIdV2,
132+ input_source,
133+ )
134+
135+ # You can keep track of the job's ID for traceability concerns.
136+ job_id = enqueue_response.job.id
137+
138+
139+ # Load the JSON string sent by the Mindee webhook POST callback.
140+ # Reading the callback data will vary greatly depending on your HTTP server.
141+ # This is therefore beyond the scope of this example.
142+
143+ local_response = LocalResponse(request.body())
144+
145+ # You can also load the json from a local path.
146+ # local_response = LocalResponse("path/to/my/file.ext")
147+
148+ # Optional: verify the HMAC signature
149+ if not local_response.is_valid_hmac_signature(my_secret_key, " some signature" ):
150+ raise Error(" Invalid HMAC signature!" )
151+
152+ # Deserialize the response
153+
154+ result = mindee_client.load_prediction(
155+ product.InternationalIdV2,
156+ local_response
157+ )
158+
159+ # Print a full summary of the parsed data in RST format
160+ print (result.document)
161+ ```
162+
111163
112164#### Page Options
113165Allows sending only certain pages in a PDF.
114166
115167In this example we only send the first, penultimate and last pages:
116168
117169``` python
118- from mindee import Client, product, PageOptions
170+ from mindee import product, PageOptions
119171
120172result = mindee_client.parse(
121173 product.InvoiceV4,
0 commit comments