Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/eventgrid/azure-eventgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 4.20.0 (2024-06-11)
## 4.20.0 (2024-06-12)

### Features Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ def _serialize_events(events):
# Try to serialize CNCF Cloud Events
return [_from_cncf_events(e) for e in events]
else:
# Does not conform to format
raise TypeError("Invalid event data. Please check the data is of Cloud Event type/format and try again.")
# Does not conform to format, try to send
return events


def _serialize_cloud_event(cloud_event):
Expand Down
4 changes: 2 additions & 2 deletions sdk/eventgrid/azure-eventgrid/migration_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ cloud_event = {

| In v1.3 | Equivalent in v4.0 | Sample |
|---|---|---|
|`EventGridClient(credentials)`|`EventGridPublisherClient(endpoint, credential)`|[Sample for client construction](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py)|
|`EventGridClient(credentials)`|`EventGridPublisherClient(endpoint, credential)`|[Sample for client construction](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py)|

### Publishing Events

The `publish_events` API is replaced with `send` in v4.0. Additionally, `send` API accepts `CloudEvent`, `EventGridEvent` along with their dict representations.

| In v1.3 | Equivalent in v4.0 | Sample |
|---|---|---|
|`EventGridClient(credentials).publish_events(topic_hostname, events)`|`EventGridPublisherClient(endpoint, credential).send(events)`|[Sample for client construction](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py)|
|`EventGridClient(credentials).publish_events(topic_hostname, events)`|`EventGridPublisherClient(endpoint, credential).send(events)`|[Sample for client construction](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/eventgrid/azure-eventgrid/samples/basic/sync_samples/sample_publish_events_using_cloud_events_1.0_schema.py)|

### Consuming Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async def test_eg_dual_client_send_custom_event(self, **kwargs):

await basic_client.send(custom_event)

with pytest.raises(TypeError):
with pytest.raises(HttpResponseError):
await namespace_client.send(custom_event)

@pytest.mark.live_test_only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_eg_dual_client_send_custom_event(self, **kwargs):

basic_client.send(custom_event)

with pytest.raises(TypeError):
with pytest.raises(HttpResponseError):
namespace_client.send(custom_event)

@pytest.mark.live_test_only
Expand Down