@@ -1934,7 +1934,7 @@ the `POST` method to call the `/workflows/<workflow-id>/run` endpoint (for `curl
1934
1934
)
1935
1935
1936
1936
with UnstructuredClient(api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")) as client:
1937
- response = client.workflows.run_workflow (
1937
+ response = client.workflows.run_workflow_async (
1938
1938
request = {
1939
1939
" workflow_id" : " <workflow-id>"
1940
1940
" body_run_workflow" : {
@@ -2779,10 +2779,66 @@ response:
2779
2779
- The ID for the file to download is in the ` output_node_files ` array's ` file_id ` field.
2780
2780
- The ID for the workflow's output node is in the ` output_node_files ` array's ` node_id ` field.
2781
2781
2782
- Currently, you cannot use the Unstructured user interface (UI) or the Unstructured Python SDK to download a file from a job that uses a
2782
+ Currently, you cannot use the Unstructured user interface (UI) to download a file from a job that uses a
2783
2783
workflow with a local source and a local destination.
2784
2784
2785
2785
<AccordionGroup >
2786
+ <Accordion title = " Python SDK" >
2787
+ ``` python
2788
+ import os
2789
+ import json
2790
+
2791
+ from unstructured_client import UnstructuredClient
2792
+ from unstructured_client.models.operations import DownloadJobOutputRequest
2793
+
2794
+ client = UnstructuredClient(
2795
+ api_key_auth = os.getenv(" UNSTRUCTURED_API_KEY" )
2796
+ )
2797
+
2798
+ response = client.jobs.download_job_output(
2799
+ request = DownloadJobOutputRequest(
2800
+ job_id = " <job-id>" ,
2801
+ file_id = " <file-id>" ,
2802
+ node_id = " <node-id>"
2803
+ )
2804
+ )
2805
+
2806
+ output_path = " </path/to/save/json/output/file>"
2807
+
2808
+ with open (output_path, " w" ) as f:
2809
+ json.dump(response.any, f, indent = 4 )
2810
+ ```
2811
+ </Accordion >
2812
+ <Accordion title = " Python SDK (async)" >
2813
+ ``` python
2814
+ import os
2815
+ import json
2816
+ import asyncio
2817
+
2818
+ from unstructured_client import UnstructuredClient
2819
+ from unstructured_client.models.operations import DownloadJobOutputRequest
2820
+
2821
+ async def download_job_output ():
2822
+ client = UnstructuredClient(
2823
+ api_key_auth = os.getenv(" UNSTRUCTURED_API_KEY" )
2824
+ )
2825
+
2826
+ response = client.jobs.download_job_output_async(
2827
+ request = DownloadJobOutputRequest(
2828
+ job_id = " <job-id>" ,
2829
+ file_id = " <file-id>" ,
2830
+ node_id = " <node-id>"
2831
+ )
2832
+ )
2833
+
2834
+ output_path = " </path/to/save/json/output/file>"
2835
+
2836
+ with open (output_path, " w" ) as f:
2837
+ json.dump(response.any, f, indent = 4 )
2838
+
2839
+ asyncio.run(download_job_output())
2840
+ ```
2841
+ </Accordion >
2786
2842
<Accordion title = " curl" >
2787
2843
``` bash
2788
2844
curl --request ' GET' --location \
0 commit comments