From 308bd974f5c2ee2211d7a7b8dd4a87fbc40c4b05 Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Mon, 4 Nov 2019 18:29:01 -0800 Subject: [PATCH 1/8] update env name in yml --- sdk/eventhub/tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/eventhub/tests.yml b/sdk/eventhub/tests.yml index 7eebea067f9a..f383a2a5f512 100644 --- a/sdk/eventhub/tests.yml +++ b/sdk/eventhub/tests.yml @@ -28,6 +28,7 @@ jobs: AZURE_STORAGE_ACCOUNT: $(python-eh-livetest-event-hub-storage-account) AZURE_STORAGE_ACCESS_KEY: $(python-eh-livetest-event-hub-storage-access-key) AZURE_STORAGE_CONN_STR: $(python-eh-livetest-event-hub-storage-conn-str) + EVENT_HUB_CONN_STR: $(python-eh-livetest-event-hub-conn-str) EVENT_HUB_HOSTNAME: $(python-eh-livetest-event-hub-hostname) EVENT_HUB_NAME: $(python-eh-livetest-event-hub-name) EVENT_HUB_SAS_POLICY: $(python-eh-livetest-event-hub-sas-policy) @@ -35,6 +36,6 @@ jobs: EVENT_HUB_NAMESPACE: $(python-eh-livetest-event-hub-namespace) IOTHUB_CONNECTION_STR: $(python-eh-livetest-event-hub-iothub-connection-str) IOTHUB_DEVICE: $(python-eh-livetest-event-hub-iothub-device) - AAD_CLIENT_ID: $(python-eh-livetest-event-hub-aad-client-id) - AAD_TENANT_ID: $(python-eh-livetest-event-hub-aad-tenant-id) - AAD_SECRET: $(python-eh-livetest-event-hub-aad-secret) + AZURE_CLIENT_ID: $(python-eh-livetest-event-hub-aad-client-id) + AZURE_TENANT_ID: $(python-eh-livetest-event-hub-aad-tenant-id) + AZURE_CLIENT_SECRET: $(python-eh-livetest-event-hub-aad-secret) From 839f5044306081cbee497f982e8deb0b5f744e63 Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Mon, 4 Nov 2019 19:00:29 -0800 Subject: [PATCH 2/8] update from connection string --- .../azure/eventhub/_consumer_client.py | 33 +++++++++++++++++++ .../azure/eventhub/_producer_client.py | 26 +++++++++++++++ .../eventhub/aio/_consumer_client_async.py | 26 +++++++++++++++ .../eventhub/aio/_producer_client_async.py | 26 +++++++++++++++ 4 files changed, 111 insertions(+) diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py index c6220e7c04c4..276f783ffc43 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py @@ -96,6 +96,39 @@ def _stop_eventprocessor(cls, event_processor): elif (consumer_group, '-1') in eventhub_client._event_processors: del eventhub_client._event_processors[(consumer_group, "-1")] + @classmethod + def from_connection_string(cls, conn_str, **kwargs): + """ + Create an EventHubConsumerClient from a connection string. + + :param str conn_str: The connection string of an eventhub. + :keyword str event_hub_path: The path of the specific Event Hub to connect the client to. + :keyword credential: The credential object used for authentication which implements particular interface + of getting tokens. It accepts ~azure.eventhub.EventHubSharedKeyCredential, + ~azure.eventhub.EventHubSASTokenCredential, credential objects generated by the azure-identity library and + objects that implement `get_token(self, *scopes)` method. + :keyword bool network_tracing: Whether to output network trace logs to the logger. Default is `False`. + :keyword dict[str, Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following + keys - 'proxy_hostname' (str value) and 'proxy_port' (int value). + Additionally the following keys may also be present - 'username', 'password'. + :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. + The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. + :keyword str user_agent: The user agent that needs to be appended to the built in user agent string. + :keyword int retry_total: The total number of attempts to redo the failed operation when an error happened. + Default value is 3. + :keyword transport_type: The type of transport protocol that will be used for communicating with + the Event Hubs service. Default is `TransportType.Amqp`. + :paramtype transport_type: ~azure.eventhub.TransportType + :keyword partition_manager: + stores the load balancing data and checkpoint data when receiving events + if partition_manager is specified. If it's None, this EventHubConsumerClient instance will receive + events without load balancing and checkpoint. + :paramtype partition_manager: Implementation classes of ~azure.eventhub.aio.PartitionManager + :keyword float load_balancing_interval: + When load balancing kicks in, this is the interval in seconds between two load balancing. Default is 10. + """ + return super(EventHubConsumerClient, cls).from_connection_string(conn_str, **kwargs) + def receive(self, on_events, consumer_group, **kwargs): # type: (Callable[[PartitionContext, List[EventData]], None], str, Any) -> None """Receive events from partition(s) optionally with load balancing and checkpointing. diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py index fc4b13c45226..f4c5850eacd5 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py @@ -71,6 +71,32 @@ def _init_locks_for_producers(self): for _ in range(num_of_producers): self._producers_locks.append(threading.Lock()) + @classmethod + def from_connection_string(cls, conn_str, **kwargs): + """ + Create an EventHubProducerClient from a connection string. + + :param str conn_str: The connection string of an eventhub. + :keyword str event_hub_path: The path of the specific Event Hub to connect the client to. + :keyword credential: The credential object used for authentication which implements particular interface + of getting tokens. It accepts ~azure.eventhub.EventHubSharedKeyCredential, + ~azure.eventhub.EventHubSASTokenCredential, credential objects generated by the azure-identity library and + objects that implement `get_token(self, *scopes)` method. + :keyword bool network_tracing: Whether to output network trace logs to the logger. Default is `False`. + :keyword dict[str, Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following + keys - 'proxy_hostname' (str value) and 'proxy_port' (int value). + Additionally the following keys may also be present - 'username', 'password'. + :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. + The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. + :keyword str user_agent: The user agent that needs to be appended to the built in user agent string. + :keyword int retry_total: The total number of attempts to redo the failed operation when an error happened. + Default value is 3. + :keyword transport_type: The type of transport protocol that will be used for communicating with + the Event Hubs service. Default is `TransportType.Amqp`. + :paramtype transport_type: ~azure.eventhub.TransportType + """ + return super(EventHubProducerClient, cls).from_connection_string(conn_str, **kwargs) + def send(self, event_data, **kwargs): # type: (Union[EventData, EventDataBatch, Iterable[EventData]], Any) -> None """ diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py index 570d4f052b45..1f605bc58f4f 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py @@ -76,6 +76,32 @@ def __init__(self, host, event_hub_path, credential, **kwargs) -> None: self._event_processors = dict() # type: Dict[Tuple[str, str], EventProcessor] self._closed = False + @classmethod + def from_connection_string(cls, conn_str, **kwargs): + """ + Create an EventHubConsumerClient from a connection string. + + :param str conn_str: The connection string of an eventhub. + :keyword str event_hub_path: The path of the specific Event Hub to connect the client to. + :keyword credential: The credential object used for authentication which implements particular interface + of getting tokens. It accepts ~azure.eventhub.EventHubSharedKeyCredential, + ~azure.eventhub.EventHubSASTokenCredential, credential objects generated by the azure-identity library and + objects that implement `get_token(self, *scopes)` method. + :keyword bool network_tracing: Whether to output network trace logs to the logger. Default is `False`. + :keyword dict[str, Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following + keys - 'proxy_hostname' (str value) and 'proxy_port' (int value). + Additionally the following keys may also be present - 'username', 'password'. + :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. + The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. + :keyword str user_agent: The user agent that needs to be appended to the built in user agent string. + :keyword int retry_total: The total number of attempts to redo the failed operation when an error happened. + Default value is 3. + :keyword transport_type: The type of transport protocol that will be used for communicating with + the Event Hubs service. Default is `TransportType.Amqp`. + :paramtype transport_type: ~azure.eventhub.TransportType + """ + return super(EventHubConsumerClient, cls).from_connection_string(conn_str, **kwargs) + async def receive( self, on_events: Callable[[PartitionContext, List[EventData]], None], consumer_group: str, *, diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py index b1514a3844d0..3d70df7ce654 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py @@ -71,6 +71,32 @@ async def _init_locks_for_producers(self): self._producers_locks.append(asyncio.Lock()) # self._producers_locks = [asyncio.Lock()] * num_of_producers + @classmethod + def from_connection_string(cls, conn_str, **kwargs): + """ + Create an EventHubProducerClient from a connection string. + + :param str conn_str: The connection string of an eventhub. + :keyword str event_hub_path: The path of the specific Event Hub to connect the client to. + :keyword credential: The credential object used for authentication which implements particular interface + of getting tokens. It accepts ~azure.eventhub.EventHubSharedKeyCredential, + ~azure.eventhub.EventHubSASTokenCredential, credential objects generated by the azure-identity library and + objects that implement `get_token(self, *scopes)` method. + :keyword bool network_tracing: Whether to output network trace logs to the logger. Default is `False`. + :keyword dict[str, Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following + keys - 'proxy_hostname' (str value) and 'proxy_port' (int value). + Additionally the following keys may also be present - 'username', 'password'. + :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. + The default value is 60 seconds. If set to 0, no timeout will be enforced from the client. + :keyword str user_agent: The user agent that needs to be appended to the built in user agent string. + :keyword int retry_total: The total number of attempts to redo the failed operation when an error happened. + Default value is 3. + :keyword transport_type: The type of transport protocol that will be used for communicating with + the Event Hubs service. Default is `TransportType.Amqp`. + :paramtype transport_type: ~azure.eventhub.TransportType + """ + return super(EventHubProducerClient, cls).from_connection_string(conn_str, **kwargs) + async def send(self, event_data: Union[EventData, EventDataBatch, Iterable[EventData]], *, partition_key: Union[str, bytes] = None, partition_id: str = None, timeout: float = None) -> None: """Sends event data and blocks until acknowledgement is received or operation times out. From c6d19937954d092e2fda06e1b77af93b5cb7af51 Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Mon, 4 Nov 2019 19:07:09 -0800 Subject: [PATCH 3/8] small fix --- .../azure/eventhub/aio/_consumer_client_async.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py index fdc3b2973446..fa1752aafe67 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py @@ -99,6 +99,13 @@ def from_connection_string(cls, conn_str, **kwargs): :keyword transport_type: The type of transport protocol that will be used for communicating with the Event Hubs service. Default is `TransportType.Amqp`. :paramtype transport_type: ~azure.eventhub.TransportType + :keyword partition_manager: + stores the load balancing data and checkpoint data when receiving events + if partition_manager is specified. If it's None, this EventHubConsumerClient instance will receive + events without load balancing and checkpoint. + :paramtype partition_manager: Implementation classes of ~azure.eventhub.aio.PartitionManager + :keyword float load_balancing_interval: + When load balancing kicks in, this is the interval in seconds between two load balancing. Default is 10. """ return super(EventHubConsumerClient, cls).from_connection_string(conn_str, **kwargs) From 1796f9b556c67d2a82070e0d91295e1d72ed5a9a Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Mon, 4 Nov 2019 22:37:06 -0800 Subject: [PATCH 4/8] Update manifest files, samples, code snippet --- .../MANIFEST.in | 2 + .../MANIFEST.in | 2 + sdk/eventhub/azure-eventhubs/HISTORY.md | 2 +- .../azure/eventhub/_consumer_client.py | 10 +++ .../azure/eventhub/_producer_client.py | 10 +++ .../eventhub/aio/_consumer_client_async.py | 9 +++ .../eventhub/aio/_producer_client_async.py | 9 +++ .../sample_code_eventhub_async.py | 81 +++++++++++++------ .../sync_samples/sample_code_eventhub.py | 62 +++++++++----- 9 files changed, 141 insertions(+), 46 deletions(-) diff --git a/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/MANIFEST.in b/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/MANIFEST.in index 7012aaaa132a..4adc07aad2ed 100644 --- a/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/MANIFEST.in +++ b/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/MANIFEST.in @@ -2,3 +2,5 @@ include *.md include azure/__init__.py include azure/eventhub/__init__.py include azure/eventhub/extensions/__init__.py +recursive-include tests *.py *.yaml +recursive-include samples *.py \ No newline at end of file diff --git a/sdk/eventhub/azure-eventhubs-checkpointstoreblob/MANIFEST.in b/sdk/eventhub/azure-eventhubs-checkpointstoreblob/MANIFEST.in index 7012aaaa132a..4adc07aad2ed 100644 --- a/sdk/eventhub/azure-eventhubs-checkpointstoreblob/MANIFEST.in +++ b/sdk/eventhub/azure-eventhubs-checkpointstoreblob/MANIFEST.in @@ -2,3 +2,5 @@ include *.md include azure/__init__.py include azure/eventhub/__init__.py include azure/eventhub/extensions/__init__.py +recursive-include tests *.py *.yaml +recursive-include samples *.py \ No newline at end of file diff --git a/sdk/eventhub/azure-eventhubs/HISTORY.md b/sdk/eventhub/azure-eventhubs/HISTORY.md index a1d4d9f2b1b8..bf2ada9d12f2 100644 --- a/sdk/eventhub/azure-eventhubs/HISTORY.md +++ b/sdk/eventhub/azure-eventhubs/HISTORY.md @@ -4,7 +4,7 @@ **Breaking changes** -- `EventHubClient` has been split into two separate clients: `EventHubProducerClient` and `EventHubConsumerClient`. +- `EventHubClient`, `EventHubConsumer` and `EventHubProducer` has been removed. Use `EventHubProducerClient` and `EventHubConsumerClient` instead. - Construction of both objects is the same as it was for the previous client. - Introduced `EventHubProducerClient` as substitution for`EventHubProducer`. - `EventHubProducerClient` supports sending events to different partitions. diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py index 276f783ffc43..84d5efcd75a9 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py @@ -126,6 +126,16 @@ def from_connection_string(cls, conn_str, **kwargs): :paramtype partition_manager: Implementation classes of ~azure.eventhub.aio.PartitionManager :keyword float load_balancing_interval: When load balancing kicks in, this is the interval in seconds between two load balancing. Default is 10. + + .. admonition:: Example: + + .. literalinclude:: ../samples/sync_samples/sample_code_eventhub.py + :start-after: [START create_eventhub_consumer_client_from_conn_str_sync] + :end-before: [END create_eventhub_consumer_client_from_conn_str_sync] + :language: python + :dedent: 4 + :caption: Create a new instance of the EventHubConsumerClient from connection string. + """ return super(EventHubConsumerClient, cls).from_connection_string(conn_str, **kwargs) diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py index f4c5850eacd5..b3e5e14c6b5f 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py @@ -94,6 +94,16 @@ def from_connection_string(cls, conn_str, **kwargs): :keyword transport_type: The type of transport protocol that will be used for communicating with the Event Hubs service. Default is `TransportType.Amqp`. :paramtype transport_type: ~azure.eventhub.TransportType + + .. admonition:: Example: + + .. literalinclude:: ../samples/sync_samples/sample_code_eventhub.py + :start-after: [START create_eventhub_producer_client_from_conn_str_sync] + :end-before: [END create_eventhub_producer_client_from_conn_str_sync] + :language: python + :dedent: 4 + :caption: Create a new instance of the EventHubProducerClient from connection string. + """ return super(EventHubProducerClient, cls).from_connection_string(conn_str, **kwargs) diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py index fa1752aafe67..d5d8a720ba1e 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py @@ -106,6 +106,15 @@ def from_connection_string(cls, conn_str, **kwargs): :paramtype partition_manager: Implementation classes of ~azure.eventhub.aio.PartitionManager :keyword float load_balancing_interval: When load balancing kicks in, this is the interval in seconds between two load balancing. Default is 10. + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_code_eventhub_async.py + :start-after: [START create_eventhub_consumer_client_from_conn_str_async] + :end-before: [END create_eventhub_consumer_client_from_conn_str_async] + :language: python + :dedent: 4 + :caption: Create a new instance of the EventHubConsumerClient from connection string. """ return super(EventHubConsumerClient, cls).from_connection_string(conn_str, **kwargs) diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py index 46c2cb2f5db5..299d9e5ccc70 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py @@ -94,6 +94,15 @@ def from_connection_string(cls, conn_str, **kwargs): :keyword transport_type: The type of transport protocol that will be used for communicating with the Event Hubs service. Default is `TransportType.Amqp`. :paramtype transport_type: ~azure.eventhub.TransportType + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_code_eventhub_async.py + :start-after: [START create_eventhub_producer_client_from_conn_str_async] + :end-before: [END create_eventhub_producer_client_from_conn_str_async] + :language: python + :dedent: 4 + :caption: Create a new instance of the EventHubProducerClient from connection string. """ return super(EventHubProducerClient, cls).from_connection_string(conn_str, **kwargs) diff --git a/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py b/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py index ed03fd1ba815..229d33676b96 100644 --- a/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py +++ b/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py @@ -10,36 +10,60 @@ def create_async_eventhub_producer_client(): + # [START create_eventhub_producer_client_from_conn_str_async] + import os + from azure.eventhub.aio import EventHubProducerClient + event_hub_connection_str = os.environ['EVENT_HUB_CONN_STR'] + event_hub = os.environ['EVENT_HUB_NAME'] + producer = EventHubProducerClient.from_connection_string(conn_str=event_hub_connection_str, + event_hub_path=event_hub) + # [END create_eventhub_producer_client_from_conn_str_async] + # [START create_eventhub_producer_client_async] import os + from azure.eventhub import EventHubSharedKeyCredential from azure.eventhub.aio import EventHubProducerClient - EVENT_HUB_CONNECTION_STR = os.environ['EVENT_HUB_CONN_STR'] - EVENT_HUB = os.environ['EVENT_HUB_NAME'] + hostname = os.environ['EVENT_HUB_HOSTNAME'] + event_hub = os.environ['EVENT_HUB_NAME'] + shared_access_policy = os.environ['EVENT_HUB_SAS_POLICY'] + shared_access_key = os.environ['EVENT_HUB_SAS_KEY'] - producer = EventHubProducerClient.from_connection_string(conn_str=EVENT_HUB_CONNECTION_STR, - event_hub_path=EVENT_HUB) + producer = EventHubProducerClient(host=hostname, + event_hub_path=event_hub, + credential=EventHubSharedKeyCredential(shared_access_policy, shared_access_key)) # [END create_eventhub_producer_client_async] return producer def create_async_eventhub_consumer_client(): + # [START create_eventhub_consumer_client_from_conn_str_async] + import os + from azure.eventhub.aio import EventHubConsumerClient + event_hub_connection_str = os.environ['EVENT_HUB_CONN_STR'] + event_hub = os.environ['EVENT_HUB_NAME'] + consumer = EventHubConsumerClient.from_connection_string(conn_str=event_hub_connection_str, + event_hub_path=event_hub) + # [END create_eventhub_consumer_client_from_conn_str_async] + # [START create_eventhub_consumer_client_async] import os + from azure.eventhub import EventHubSharedKeyCredential + from azure.eventhub.aio import EventHubConsumerClient - EVENT_HUB_CONNECTION_STR = os.environ['EVENT_HUB_CONN_STR'] - EVENT_HUB = os.environ['EVENT_HUB_NAME'] + hostname = os.environ['EVENT_HUB_HOSTNAME'] + event_hub = os.environ['EVENT_HUB_NAME'] + shared_access_policy = os.environ['EVENT_HUB_SAS_POLICY'] + shared_access_key = os.environ['EVENT_HUB_SAS_KEY'] - from azure.eventhub.aio import EventHubConsumerClient - consumer = EventHubConsumerClient.from_connection_string( - conn_str=EVENT_HUB_CONNECTION_STR, - event_hub_path=EVENT_HUB - ) + consumer = EventHubConsumerClient(host=hostname, + event_hub_path=event_hub, + credential=EventHubSharedKeyCredential(shared_access_policy, shared_access_key)) # [END create_eventhub_consumer_client_async] return consumer -async def example_eventhub_async_send_and_receive(live_eventhub_config): +async def example_eventhub_async_send_and_receive(): producer = create_async_eventhub_producer_client() consumer = create_async_eventhub_consumer_client() try: @@ -59,6 +83,7 @@ async def example_eventhub_async_send_and_receive(live_eventhub_config): async with producer: event_data = EventData(b"A single event") await producer.send(event_data) + print('send done') # [END eventhub_producer_client_send_async] await asyncio.sleep(1) @@ -68,27 +93,27 @@ async def example_eventhub_async_send_and_receive(live_eventhub_config): async def on_events(partition_context, events): logger.info("Received {} messages from partition: {}".format( len(events), partition_context.partition_id)) + print("Received {} messages from partition: {}".format( + len(events), partition_context.partition_id)) # Do ops on received events async with consumer: - task = asyncio.ensure_future(consumer.receive(on_events=on_events, consumer_group="$default")) - await asyncio.sleep(3) # keep receiving for 3 seconds - task.cancel() # stop receiving + await consumer.receive(on_events=on_events, consumer_group="$default") # [END eventhub_consumer_client_receive_async] finally: pass -async def example_eventhub_async_producer_ops(live_eventhub_config, connection_str): +async def example_eventhub_async_producer_ops(): # [START eventhub_producer_client_close_async] import os from azure.eventhub.aio import EventHubProducerClient from azure.eventhub import EventData - EVENT_HUB_CONNECTION_STR = os.environ['EVENT_HUB_CONN_STR'] - EVENT_HUB = os.environ['EVENT_HUB_NAME'] + event_hub_connection_str = os.environ['EVENT_HUB_CONN_STR'] + event_hub = os.environ['EVENT_HUB_NAME'] - producer = EventHubProducerClient.from_connection_string(conn_str=EVENT_HUB_CONNECTION_STR, - event_hub_path=EVENT_HUB) + producer = EventHubProducerClient.from_connection_string(conn_str=event_hub_connection_str, + event_hub_path=event_hub) try: await producer.send(EventData(b"A single event")) finally: @@ -97,17 +122,17 @@ async def example_eventhub_async_producer_ops(live_eventhub_config, connection_s # [END eventhub_producer_client_close_async] -async def example_eventhub_async_consumer_ops(live_eventhub_config, connection_str): +async def example_eventhub_async_consumer_ops(): # [START eventhub_consumer_client_close_async] import os - EVENT_HUB_CONNECTION_STR = os.environ['EVENT_HUB_CONN_STR'] - EVENT_HUB = os.environ['EVENT_HUB_NAME'] + event_hub_connection_str = os.environ['EVENT_HUB_CONN_STR'] + event_hub = os.environ['EVENT_HUB_NAME'] from azure.eventhub.aio import EventHubConsumerClient consumer = EventHubConsumerClient.from_connection_string( - conn_str=EVENT_HUB_CONNECTION_STR, - event_hub_path=EVENT_HUB + conn_str=event_hub_connection_str, + event_hub_path=event_hub ) logger = logging.getLogger("azure.eventhub") @@ -127,3 +152,9 @@ async def on_events(partition_context, events): # Close down the consumer handler explicitly. await consumer.close() # [END eventhub_consumer_client_close_async] + +if __name__ == '__main__': + loop = asyncio.get_event_loop() + loop.run_until_complete(example_eventhub_async_producer_ops()) + loop.run_until_complete(example_eventhub_async_consumer_ops()) + # loop.run_until_complete(example_eventhub_async_send_and_receive()) diff --git a/sdk/eventhub/azure-eventhubs/samples/sync_samples/sample_code_eventhub.py b/sdk/eventhub/azure-eventhubs/samples/sync_samples/sample_code_eventhub.py index 8c1eaa9de893..5869060be95e 100644 --- a/sdk/eventhub/azure-eventhubs/samples/sync_samples/sample_code_eventhub.py +++ b/sdk/eventhub/azure-eventhubs/samples/sync_samples/sample_code_eventhub.py @@ -9,31 +9,53 @@ def create_eventhub_producer_client(): - # [START create_eventhub_producer_client_sync] + # [START create_eventhub_producer_client_from_conn_str_sync] import os from azure.eventhub import EventHubProducerClient + event_hub_connection_str = os.environ['EVENT_HUB_CONN_STR'] + event_hub = os.environ['EVENT_HUB_NAME'] + producer = EventHubProducerClient.from_connection_string(conn_str=event_hub_connection_str, + event_hub_path=event_hub) + # [END create_eventhub_producer_client_from_conn_str_sync] - EVENT_HUB_CONNECTION_STR = os.environ['EVENT_HUB_CONN_STR'] - EVENT_HUB = os.environ['EVENT_HUB_NAME'] + # [START create_eventhub_producer_client_sync] + import os + from azure.eventhub import EventHubProducerClient, EventHubSharedKeyCredential - producer = EventHubProducerClient.from_connection_string(conn_str=EVENT_HUB_CONNECTION_STR, - event_hub_path=EVENT_HUB) + hostname = os.environ['EVENT_HUB_HOSTNAME'] + event_hub = os.environ['EVENT_HUB_NAME'] + shared_access_policy = os.environ['EVENT_HUB_SAS_POLICY'] + shared_access_key = os.environ['EVENT_HUB_SAS_KEY'] + + producer = EventHubProducerClient(host=hostname, + event_hub_path=event_hub, + credential=EventHubSharedKeyCredential(shared_access_policy, shared_access_key)) # [END create_eventhub_producer_client_sync] return producer def create_eventhub_consumer_client(): + # [START create_eventhub_consumer_client_from_conn_str_sync] + import os + from azure.eventhub import EventHubConsumerClient + event_hub_connection_str = os.environ['EVENT_HUB_CONN_STR'] + event_hub = os.environ['EVENT_HUB_NAME'] + consumer = EventHubConsumerClient.from_connection_string(conn_str=event_hub_connection_str, + event_hub_path=event_hub) + # [END create_eventhub_consumer_client_from_conn_str_sync] + # [START create_eventhub_consumer_client_sync] import os + from azure.eventhub import EventHubConsumerClient, EventHubSharedKeyCredential - EVENT_HUB_CONNECTION_STR = os.environ['EVENT_HUB_CONN_STR'] - EVENT_HUB = os.environ['EVENT_HUB_NAME'] + hostname = os.environ['EVENT_HUB_HOSTNAME'] + event_hub = os.environ['EVENT_HUB_NAME'] + shared_access_policy = os.environ['EVENT_HUB_SAS_POLICY'] + shared_access_key = os.environ['EVENT_HUB_SAS_KEY'] - from azure.eventhub import EventHubConsumerClient - consumer = EventHubConsumerClient.from_connection_string( - conn_str=EVENT_HUB_CONNECTION_STR, - event_hub_path=EVENT_HUB - ) + consumer = EventHubConsumerClient(host=hostname, + event_hub_path=event_hub, + credential=EventHubSharedKeyCredential(shared_access_policy, shared_access_key)) # [END create_eventhub_consumer_client_sync] return consumer @@ -93,11 +115,11 @@ def example_eventhub_producer_ops(): import os from azure.eventhub import EventHubProducerClient, EventData - EVENT_HUB_CONNECTION_STR = os.environ['EVENT_HUB_CONN_STR'] - EVENT_HUB = os.environ['EVENT_HUB_NAME'] + event_hub_connection_str = os.environ['EVENT_HUB_CONN_STR'] + event_hub = os.environ['EVENT_HUB_NAME'] - producer = EventHubProducerClient.from_connection_string(conn_str=EVENT_HUB_CONNECTION_STR, - event_hub_path=EVENT_HUB) + producer = EventHubProducerClient.from_connection_string(conn_str=event_hub_connection_str, + event_hub_path=event_hub) try: producer.send(EventData(b"A single event")) finally: @@ -111,13 +133,13 @@ def example_eventhub_consumer_ops(): import os import threading - EVENT_HUB_CONNECTION_STR = os.environ['EVENT_HUB_CONN_STR'] - EVENT_HUB = os.environ['EVENT_HUB_NAME'] + event_hub_connection_str = os.environ['EVENT_HUB_CONN_STR'] + event_hub = os.environ['EVENT_HUB_NAME'] from azure.eventhub import EventHubConsumerClient consumer = EventHubConsumerClient.from_connection_string( - conn_str=EVENT_HUB_CONNECTION_STR, - event_hub_path=EVENT_HUB + conn_str=event_hub_connection_str, + event_hub_path=event_hub ) logger = logging.getLogger("azure.eventhub") From 050eff0a30bee68347a7b64bcc67a35b8a02cd2e Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Mon, 4 Nov 2019 23:02:52 -0800 Subject: [PATCH 5/8] Fix in docstring --- .../azure-eventhubs/azure/eventhub/_consumer_client.py | 2 +- .../azure/eventhub/_eventprocessor/partition_manager.py | 7 ++++--- .../azure-eventhubs/azure/eventhub/_producer_client.py | 2 +- .../azure/eventhub/aio/_consumer_client_async.py | 2 +- .../azure/eventhub/aio/_producer_client_async.py | 2 +- .../azure/eventhub/aio/eventprocessor/partition_manager.py | 7 ++++--- sdk/eventhub/azure-eventhubs/azure/eventhub/common.py | 3 ++- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py index df24ed52f6ad..9d7617ff94dd 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py @@ -105,7 +105,7 @@ def from_connection_string(cls, conn_str, **kwargs): :param str conn_str: The connection string of an eventhub. :keyword str event_hub_path: The path of the specific Event Hub to connect the client to. :keyword bool network_tracing: Whether to output network trace logs to the logger. Default is `False`. - :keyword dict[str, Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following + :keyword dict[str,Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following keys - 'proxy_hostname' (str value) and 'proxy_port' (int value). Additionally the following keys may also be present - 'username', 'password'. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/_eventprocessor/partition_manager.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/_eventprocessor/partition_manager.py index c90d2dceaf7d..db8545bd84da 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/_eventprocessor/partition_manager.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/_eventprocessor/partition_manager.py @@ -67,9 +67,10 @@ def update_checkpoint(self, fully_qualified_namespace, eventhub_name, consumer_g the Event Hubs namespace that contains it. :param str consumer_group_name: The name of the consumer group the ownership are associated with. :param str partition_id: The partition id which the checkpoint is created for. - :param str offset: The offset of the ~azure.eventhub.EventData the new checkpoint will be associated with. - :param int sequence_number: The sequence_number of the ~azure.eventhub.EventData the new checkpoint - will be associated with. + :param str offset: The offset of the :class:`EventData` + the new checkpoint will be associated with. + :param int sequence_number: The sequence_number of the :class:`EventData` + the new checkpoint will be associated with. :rtype: None """ diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py index cf24e288f7e2..02337bc21087 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/_producer_client.py @@ -81,7 +81,7 @@ def from_connection_string(cls, conn_str, **kwargs): :param str conn_str: The connection string of an eventhub. :keyword str event_hub_path: The path of the specific Event Hub to connect the client to. :keyword bool network_tracing: Whether to output network trace logs to the logger. Default is `False`. - :keyword dict[str, Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following + :keyword dict[str,Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following keys - 'proxy_hostname' (str value) and 'proxy_port' (int value). Additionally the following keys may also be present - 'username', 'password'. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py index 956604503874..fd09857fe353 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_consumer_client_async.py @@ -85,7 +85,7 @@ def from_connection_string(cls, conn_str, **kwargs): :param str conn_str: The connection string of an eventhub. :keyword str event_hub_path: The path of the specific Event Hub to connect the client to. :keyword bool network_tracing: Whether to output network trace logs to the logger. Default is `False`. - :keyword dict[str, Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following + :keyword dict[str,Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following keys - 'proxy_hostname' (str value) and 'proxy_port' (int value). Additionally the following keys may also be present - 'username', 'password'. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py index 68f524489dad..51f1eff40cfb 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/_producer_client_async.py @@ -81,7 +81,7 @@ def from_connection_string(cls, conn_str, **kwargs): :param str conn_str: The connection string of an eventhub. :keyword str event_hub_path: The path of the specific Event Hub to connect the client to. :keyword bool network_tracing: Whether to output network trace logs to the logger. Default is `False`. - :keyword dict[str, Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following + :keyword dict[str,Any] http_proxy: HTTP proxy settings. This must be a dictionary with the following keys - 'proxy_hostname' (str value) and 'proxy_port' (int value). Additionally the following keys may also be present - 'username', 'password'. :keyword float auth_timeout: The time in seconds to wait for a token to be authorized by the service. diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/eventprocessor/partition_manager.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/eventprocessor/partition_manager.py index f6f8ea18860f..114f9422eedd 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/eventprocessor/partition_manager.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/eventprocessor/partition_manager.py @@ -65,9 +65,10 @@ async def update_checkpoint(self, fully_qualified_namespace: str, eventhub_name: the Event Hubs namespace that contains it. :param str consumer_group_name: The name of the consumer group the ownership are associated with. :param str partition_id: The partition id which the checkpoint is created for. - :param str offset: The offset of the ~azure.eventhub.EventData the new checkpoint will be associated with. - :param int sequence_number: The sequence_number of the ~azure.eventhub.EventData the new checkpoint - will be associated with. + :param str offset: The offset of the :class:`EventData` + the new checkpoint will be associated with. + :param int sequence_number: The sequence_number of the :class:`EventData` + the new checkpoint will be associated with. :rtype: None """ diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/common.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/common.py index 2d203280773a..38f6caa2e185 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/common.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/common.py @@ -319,7 +319,8 @@ class EventDataBatch(object): Use `try_add` method to add events until the maximum batch size limit in bytes has been reached - a `ValueError` will be raised. - Use `send` method of ~azure.eventhub.EventHubProducerClient or ~azure.eventhub.aio.EventHubProducerClient + Use `send` method of :class:`EventHubProducerClient` + or the async :class:`EventHubProducerClient` for sending. The `send` method accepts partition_key as a parameter for sending a particular partition. **Please use the create_batch method of EventHubProducerClient From 88e22701936f8b06eab444f6645fc194dea76dbb Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Mon, 4 Nov 2019 23:07:43 -0800 Subject: [PATCH 6/8] update readme --- sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/README.md | 2 +- sdk/eventhub/azure-eventhubs-checkpointstoreblob/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/README.md b/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/README.md index 2733803eed1c..a7abbaf01131 100644 --- a/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/README.md +++ b/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio/README.md @@ -5,7 +5,7 @@ This Checkpoint Store package works as a plug-in package to `EventHubConsumerCli Please note that this is an async library, for sync version of the Azure EventHubs Checkpoint Store client library, please refer to [azure-eventhubs-checkpointstoreblob](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhubs-checkpointstoreblob). -[Source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio) | [Package (PyPi)](https://pypi.org/project/azure-eventhub-checkpointstoreblob-aio/) | [API reference documentation](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-eventhub/5.0.0b5/azure.eventhub.extensions.html) | [Azure Eventhubs documentation](https://docs.microsoft.com/en-us/azure/event-hubs/) | [Azure Storage documentation](https://docs.microsoft.com/en-us/azure/storage/) +[Source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio) | [Package (PyPi)](https://pypi.org/project/azure-eventhub-checkpointstoreblob-aio/) | [API reference documentation](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-eventhub/5.0.0b5/azure.eventhub.aio.html#azure.eventhub.aio.PartitionManager) | [Azure Eventhubs documentation](https://docs.microsoft.com/en-us/azure/event-hubs/) | [Azure Storage documentation](https://docs.microsoft.com/en-us/azure/storage/) ## Getting started diff --git a/sdk/eventhub/azure-eventhubs-checkpointstoreblob/README.md b/sdk/eventhub/azure-eventhubs-checkpointstoreblob/README.md index 1b47a54ecd35..07cfd57bc247 100644 --- a/sdk/eventhub/azure-eventhubs-checkpointstoreblob/README.md +++ b/sdk/eventhub/azure-eventhubs-checkpointstoreblob/README.md @@ -5,7 +5,7 @@ This Checkpoint Store package works as a plug-in package to `EventHubConsumerCli Please note that this is a sync library, for async version of the Azure EventHubs Checkpoint Store client library, please refer to [azure-eventhubs-checkpointstoreblob-aio](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhubs-checkpointstoreblob-aio). -[Source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhubs-checkpointstoreblob) | [Package (PyPi)](https://pypi.org/project/azure-eventhub-checkpointstoreblob/) | [API reference documentation](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-eventhub/5.0.0b5/azure.eventhub.extensions.html) | [Azure Eventhubs documentation](https://docs.microsoft.com/en-us/azure/event-hubs/) | [Azure Storage documentation](https://docs.microsoft.com/en-us/azure/storage/) +[Source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhubs-checkpointstoreblob) | [Package (PyPi)](https://pypi.org/project/azure-eventhub-checkpointstoreblob/) | [API reference documentation](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-eventhub/5.0.0b5/azure.eventhub.html#azure.eventhub.PartitionManager) | [Azure Eventhubs documentation](https://docs.microsoft.com/en-us/azure/event-hubs/) | [Azure Storage documentation](https://docs.microsoft.com/en-us/azure/storage/) ## Getting started From 2075eb60aa8c4aeadbaaa40d75c096230e68b8a7 Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Mon, 4 Nov 2019 23:13:27 -0800 Subject: [PATCH 7/8] Small fix --- .../azure-eventhubs/azure/eventhub/_consumer_client.py | 1 + .../samples/async_samples/sample_code_eventhub_async.py | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py index 9d7617ff94dd..cbf7f299ac51 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/_consumer_client.py @@ -99,6 +99,7 @@ def _stop_eventprocessor(cls, event_processor): @classmethod def from_connection_string(cls, conn_str, **kwargs): + # type: (str, Any) -> EventHubConsumerClient """ Create an EventHubConsumerClient from a connection string. diff --git a/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py b/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py index 229d33676b96..f5ad9adf0324 100644 --- a/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py +++ b/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py @@ -83,7 +83,6 @@ async def example_eventhub_async_send_and_receive(): async with producer: event_data = EventData(b"A single event") await producer.send(event_data) - print('send done') # [END eventhub_producer_client_send_async] await asyncio.sleep(1) @@ -93,8 +92,6 @@ async def example_eventhub_async_send_and_receive(): async def on_events(partition_context, events): logger.info("Received {} messages from partition: {}".format( len(events), partition_context.partition_id)) - print("Received {} messages from partition: {}".format( - len(events), partition_context.partition_id)) # Do ops on received events async with consumer: await consumer.receive(on_events=on_events, consumer_group="$default") From 32415adc6ae21760eba07c1b8bc2e865b4eaabd6 Mon Sep 17 00:00:00 2001 From: Yunhao Ling Date: Mon, 4 Nov 2019 23:14:23 -0800 Subject: [PATCH 8/8] remove unused import --- .../samples/async_samples/sample_code_eventhub_async.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py b/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py index f5ad9adf0324..6fb29ab47015 100644 --- a/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py +++ b/sdk/eventhub/azure-eventhubs/samples/async_samples/sample_code_eventhub_async.py @@ -4,7 +4,6 @@ # license information. #-------------------------------------------------------------------------- -import pytest import logging import asyncio