@@ -187,35 +187,35 @@ Next, you'll add your own code to the Python script to call the Form Recognizer
187
187
188
188
1. Next, add code to query the service and get the returned data.
189
189
190
- ```Python
191
- resp = requests.post(url = post_url, data = source, headers = headers)
192
- if resp.status_code != 202:
193
- print("POST analyze failed:\n%s" % resp.text)
194
- quit()
195
- print("POST analyze succeeded:\n%s" % resp.headers)
196
- get_url = resp.headers["operation-location"]
190
+ ```python
191
+ resp = requests.post(url=post_url, data=source, headers=headers)
197
192
198
- wait_sec = 25
193
+ if resp.status_code != 202:
194
+ print("POST analyze failed:\n%s" % resp.text)
195
+ quit()
196
+ print("POST analyze succeeded:\n%s" % resp.headers)
197
+ get_url = resp.headers["operation-location"]
199
198
200
- time.sleep(wait_sec)
201
- # The layout API is async therefore the wait statement
199
+ wait_sec = 25
202
200
203
- resp =requests.get(url = get_url, headers = {"Ocp-Apim-Subscription-Key": apim_key})
201
+ time.sleep(wait_sec)
202
+ # The layout API is async therefore the wait statement
204
203
205
- resp_json = json.loads(resp.text )
204
+ resp = requests.get(url=get_url, headers={"Ocp-Apim-Subscription-Key": apim_key} )
206
205
206
+ resp_json = json.loads(resp.text)
207
207
208
- status = resp_json["status"]
208
+ status = resp_json["status"]
209
209
210
+ if status == "succeeded":
211
+ print("POST Layout Analysis succeeded:\n%s")
212
+ results = resp_json
213
+ else:
214
+ print("GET Layout results failed:\n%s")
215
+ quit()
210
216
211
- if status == "succeeded":
212
- print("POST Layout Analysis succeeded:\n%s")
213
- results=resp_json
214
- else:
215
- print("GET Layout results failed:\n%s")
216
- quit()
217
+ results = resp_json
217
218
218
- results=resp_json
219
219
```
220
220
221
221
1. Add the following code to connect to the Azure Storage **output** container. Fill in your own values for the storage account name and key. You can get the key on the **Access keys** tab of your storage resource in the Azure portal.
0 commit comments