Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am trying to use a Python script to load data to an Eventstream on Microsoft Fabric, inspired by this article:
My scenario is slightly different: instead of getting the data from an API, I am getting temperature data from an Arduino device, connected to an on-premise Windows Server 2022.
The data come from the device correctly, and I transform it into a JSON that I would like to send to the eventstream thanks to a python script running on my server.
Python and all the packages are correctly installed, and I have admin privileges on the workspace.
This is the Python code that I am trying to use:
The code run correctly until the "await producer.create_batch() " row, which generate the following error:
azure.eventhub.exceptions.ConnectError: Failed to initiate the connection due to exception: [WinError 121] The semaphore timeout period has expired
I imagine that it is a network issue, but I can't figure out how to solve it.
The firewall has a rule that allow port 443 oubound connections.
What am I missing?
Thank you a lot
Marco Fogale
Hi @MarcoFogale ,
Please take the following steps to troubleshoot the problem:
1. Verify Connection String and Event Hub Name, ensure that the and you are using in your script are correct.
2. Since the error message indicates a timeout, it's possible that network latency or connectivity issues between your Windows Server and the Azure Event Hub are causing the timeout. You can use tools like or to check the connectivity and latency to the Azure Event Hub endpoint.
3. Although the Azure Event Hub SDK may not directly expose a timeout setting, you can try adjusting the underlying network settings or use a retry policy with a longer timeout. Refer to the Azure Event Hubs retry policy documentation for guidance on implementing a custom retry policy.
4. Ensure that there are no additional firewalls, VPNs, or network security groups that might be interfering with the connection to Azure Event Hubs.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.