Skip to content

Latest commit

 

History

History
58 lines (47 loc) · 1.61 KB

USAGE.md

File metadata and controls

58 lines (47 loc) · 1.61 KB
# Synchronous Example
from unstructured_client import UnstructuredClient
from unstructured_client.models import shared

with UnstructuredClient() as uc_client:

    res = uc_client.destinations.create_destination(request={
        "create_destination_connector": {
            "config": {
                "endpoint": "<value>",
                "index": "<value>",
                "key": "<key>",
            },
            "name": "<value>",
            "type": shared.DestinationConnectorType.ASTRADB,
        },
    })

    assert res.destination_connector_information is not None

    # Handle response
    print(res.destination_connector_information)

The same SDK client can also be used to make asychronous requests by importing asyncio.

# Asynchronous Example
import asyncio
from unstructured_client import UnstructuredClient
from unstructured_client.models import shared

async def main():
    async with UnstructuredClient() as uc_client:

        res = await uc_client.destinations.create_destination_async(request={
            "create_destination_connector": {
                "config": {
                    "endpoint": "<value>",
                    "index": "<value>",
                    "key": "<key>",
                },
                "name": "<value>",
                "type": shared.DestinationConnectorType.ASTRADB,
            },
        })

        assert res.destination_connector_information is not None

        # Handle response
        print(res.destination_connector_information)

asyncio.run(main())