@@ -187,36 +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"]
197
-
198
- wait_sec = 25
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"]
199
197
200
- time.sleep(wait_sec)
201
- # The layout API is async therefore the wait statement
198
+ wait_sec = 25
202
199
203
- resp =requests.get(url = get_url, headers = {"Ocp-Apim-Subscription-Key": apim_key})
200
+ time.sleep(wait_sec)
201
+ # The layout API is async therefore the wait statement
204
202
205
- resp_json = json.loads(resp.text )
203
+ resp = requests.get(url=get_url, headers={"Ocp-Apim-Subscription-Key": apim_key} )
206
204
205
+ resp_json = json.loads(resp.text)
207
206
208
- status = resp_json["status"]
207
+ status = resp_json["status"]
209
208
209
+ if status == "succeeded":
210
+ print("POST Layout Analysis succeeded:\n%s")
211
+ results = resp_json
212
+ else:
213
+ print("GET Layout results failed:\n%s")
214
+ quit()
210
215
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()
216
+ results = resp_json
217
217
218
- results=resp_json
219
- ```
218
+ ```
220
219
221
220
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.
222
221
0 commit comments