Create new source

async AsyncCogniteClient.hosted_extractors.sources.create(
items: SourceWrite | Sequence[SourceWrite],
) Source | SourceList

Create one or more sources.

Parameters:

items (SourceWrite | Sequence[SourceWrite]) – Source(s) to create.

Returns:

Created source(s)

Return type:

Source | SourceList

Examples

Create new source:

>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes.hosted_extractors import EventHubSourceWrite
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> source = EventHubSourceWrite(
...     "my_event_hub", "http://myeventhub.com", "My EventHub", "my_key", "my_value"
... )
>>> res = client.hosted_extractors.sources.create(source)