Forum Discussion

dangermaus33's avatar
dangermaus33
Copper Contributor
Aug 09, 2021

Access Python Flask app running on an Azure VM

I created a simple python app that has a client part that accesses (uses the requests library) another app (web app) using Flask library to get data. Everything works when I run it locally. I put the web app portion on a Windows VM in Azure and then try to access it from the client on my local machine. I added an inbound port rule on the Azure VM to open port 5000. I then updated the client app to use the public IP address of the Azure VM and it uses port 5000 as well. I run the web app and then tried running the client with both HTTP and HTTPS in my Get request:

getproduct = requests.get("https://13.66.191.67:5000/products")

I get this error:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='13.66.191.66', port=5000): Max retries exceeded with url: /products (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000009DF56639D0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))

Any ideas on what I should check next?

1 Reply

  • dangermaus33's avatar
    dangermaus33
    Copper Contributor
    I spent all day but I figured it out. It was the firewall on the VM itself blocking port 5000.

Resources