Azure Event Grid Client Library Python Samples
Sync samples
These code samples show common champion scenario operations with the Azure Event Grid client library.
Authenticate the client: sample_authentication.py or sample_namespace_authentication.py
Publish Cloud Event to a namespace topic: sample_publish_cloud_event.py
Publish Event Grid Events to a topic: sample_publish_eg_events_to_a_topic.py
Publish EventGrid Events to a domain topic: sample_publish_eg_events_to_a_domain_topic.py
Publish a Cloud Event: sample_publish_events_using_cloud_events_1.0_schema.py
Publish a Custom Schema: sample_publish_custom_schema_to_a_topic.py
To publish events, dict representation of the models could also be used as follows:
Publish EventGridEvent as dict like representation: sample_publish_eg_event_using_dict.py
Publish CloudEvent as dict like representation: sample_publish_cloud_event_using_dict.py
Consume a Custom Payload of raw cloudevent data: sample_consume_custom_payload.py
Async samples
These code samples show common champion scenario operations with the Azure Event Grid client library using the async client.
Authenticate the client: sample_authentication_async.py or sample_namespace_authentication_async.py
Publish Cloud Event to a namespace topic: sample_publish_cloud_event_async.py
Publish EventGrid Events to a topic: sample_publish_eg_events_to_a_topic_async.py
Publish EventGrid Events to a domain topic: sample_publish_eg_events_to_a_domain_topic_async.py
Publish a Cloud Event: sample_publish_events_using_cloud_events_1.0_schema_async.py
Publish a Custom Schema: sample_publish_custom_schema_to_a_topic_async.py
To publish events, dict representation of the models could also be used as follows:
- Publish EventGridEvent as dict like representation: sample_publish_eg_event_using_dict_async.py
- Publish CloudEvent as dict like representation: sample_publish_cloud_event_using_dict_async.py
More Samples
- More samples related to the send scenario can be seen here.
- To see more samples related to consuming a payload from different messaging services as a typed object, please visit Consume Samples