azure.eventgrid.aio package

class azure.eventgrid.aio.EventGridPublisherClient(endpoint: str, credential: Union[azure.core.credentials.AzureKeyCredential, azure.core.credentials.AzureSasCredential], **kwargs: Any)[source]

Asynchronous EventGrid Python Publisher Client.

Parameters
  • endpoint (str) – The topic endpoint to send the events to.

  • credential (AzureKeyCredential or AzureSasCredential) – The credential object used for authentication which implements SAS key authentication or SAS token authentication.

Return type

None

async close()None[source]

Close the EventGridPublisherClient session.

async send(events: Union[azure.eventgrid._models.CloudEvent, azure.eventgrid._models.EventGridEvent, Dict, List[azure.eventgrid._models.CloudEvent], List[azure.eventgrid._models.EventGridEvent], List[Dict]], **kwargs: Any)None[source]

Sends event data to topic hostname specified during client initialization. Multiple events can be published at once by seding a list of events. It is very inefficient to loop the send method for each event instead of just using a list and we highly recommend against it.

Parameters

events (SendType) – A list of CloudEvent/EventGridEvent to be sent.

Keyword Arguments

content_type (str) – The type of content to be used to send the events. Has default value “application/json; charset=utf-8” for EventGridEvents, with “cloudevents-batch+json” for CloudEvents

Return type

None

Raises

ValueError, when events do not follow specified SendType.