Python rest API request connection refused

mike.battcock6TFZ9
Explorer
Explorer

Python rest API request connection refused

mike.battcock6TFZ9
Explorer
Explorer

I have a rest API currently running on localhost, port 3000.

 

I'm able to use a get request in python in any other application or environment and it works fine but for some reason when I try to run it inside flame (in a python hook or the python console) I get a connection error:

 

Failed to establish a new connection: [Errno 61] Connection refused 

 

I don't think there are any other flame services running on port 3000 so I'm not sure what the issue is. Is there a firewall in flame maybe?

0 Likes
Reply
Accepted solutions (1)
486 Views
4 Replies
Replies (4)

ManChicken
Collaborator
Collaborator
Accepted solution

Two random guesses:

 

1. Is this on Mac? If so it might be some MacOS firewall/security setting, but I'm not a Mac person so I can't give you anything specific.

 

2. Check if your thing listening on localhost:3000 is actually listening on 127.0.0.1 (ipv4), ::1 (ipv6) or both -- it's possible it might be bound to only one or the other, but you're losing the lottery when you try to connect to 'localhost' and it resolves to the other one.

 

There's nothing in Flame specifically that should prevent you from making the connection; I have a Python hook of my own that connects to another device on the LAN. So I suspect something else is going on.

Bob Maple | idolum
0 Likes

Beau_James
Autodesk
Autodesk

I am not aware of any Flame or Flame adjacent activity on that port.  What OS and version?  What does

sudo lsof -Pni |  grep '3000.*LISTEN' report back?

Can you share the script, maybe there is an indiactor there.

0 Likes

loveneeshtejan23
Community Visitor
Community Visitor

When encountering a "connection refused" error while making a REST API request in Python, it typically indicates that the server you're trying to connect to is either down, unreachable, or blocking the request. Common causes include: Incorrect URL or port number in the API request. The server isn't running or is improperly configured. Firewall or security settings on the server blocking external requests. Misconfigured DNS or networking issues. To troubleshoot, ensure the API endpoint is correct, the server is up, and check network configurations. You can also use tools like ping or curl for further diagnosis.

0 Likes

mike.battcock6TFZ9
Explorer
Explorer

Sorry i've been away for a week but thank you for all the help. I've managed to get it working. I was using localhost for testing purposes which works fine in Sublime and Houdini, but i've changed my app to run on 0.0.0.0 (while developing) which now works in flame too

0 Likes