Hi,
I was trying to send data to my azure event hub using python code sample provided in the tutorial.
All clients failed to start.
import logging
import time
from azure.eventhub import EventHubClient, EventData
logger = logging.getLogger("azure")
ADDRESS = "amqps://myeventhubnamespace.servicebus.windows.net/myeventhubname"
USER = "RootManageSharedAccessKey"
KEY = "mykey******"
try:
if not ADDRESS:
raise ValueError("amqps://myeventhubnamespace.servicebus.windows.net/myeventhubname")
client = EventHubClient(ADDRESS, debug=False, username=USER, password=KEY)
sender = client.add_sender(partition="0")
client.run()
try:
start_time = time.time()
for i in range(100):
print("Sending message: {}".format(i))
sender.send(EventData(str(i)))
except:
raise
finally:
end_time = time.time()
client.stop()
run_time = end_time - start_time
logger.info("Runtime: {} seconds".format(run_time))
except KeyboardInterrupt:
pass
Traceback (most recent call last):
File AzureEventHubSender.py", line 21, in <module>
client.run()
File "client.py", line 322, in run
raise failed[0]
azure.eventhub.common.EventHubError: Unable to open authentication session on connection b'EHSender-be4839bc-f170-4ef7-9516-341449c5e1aa-partition0'.
Please confirm target hostname exists: b'nmeventhubwestus.servicebus.windows.net'
Process finished with exit code 1
as suggested on different post I opened port 5672, 5671 and 433 outbound on my machine and it still gives same error.