Need help getting python requests to HTTP URL to work

User-879f67670f
Tue, 01 Apr 2025 07:38:10 +0000
Pipeline & Plugins

Hey all!

I have been really struggling with this, not sure what is going on , but I cannot seem to get the python requests module or the websockets module to connect to the End point I’m defining, even when I get confirmation the Server is running in engine.

To Run through what I’ve done:

1. I opened up Ports for the firewall for the ports I’m trying, in this case 30000, 30001, 30002

2. In unreal I had previously edited the BaseEngine.ini and DefaultEngine.ini files with these as well as multiple other combinations (including purging those files of these and just using the in engine project settings (I have tried making addresses the same for each as well with no luck):
[RemoteControl]
bEnableRemoteControlAPI=True
RemoteControlWebInterfaceBindAddress=127.0.0.1
RemoteControlWebInterfaceBindPort=30002
RemoteControlHttpServerBindAddress=127.0.0.3
RemoteControlHttpServerPort=30002
RemoteControlWebSocketServerBindAddress=127.0.0.2
RemoteControlWebSocketServerPort=30002
RemoteControlServerPort=30002

[HTTP]
bEnableRemoteControlAPI=True
bEnableRemoteHttpServer=True
RemoteHttpServerPort=30002

3. Project Settings were set like this:

4. In the CMD port in Unreal, I try this:

Cmd: WebControl.StartServer
LogHttpServerModule: Starting all listeners…
LogHttpListener: Created new HttpListener on 127.0.0.1:30000
LogHttpServerModule: All listeners started

Which implies the server is accessible… but when I try this from Maya, it returns:

import requests

def get_unreal_data():
url = “http://127.0.0.1:30000/remote/status” # Adjust URL if necessary

try:
    # Sending GET request to the Unreal Engine server
    response = requests.get(url)

    # Check if the response is successful (status code 200)
    if response.status_code == 200:
        # Parse JSON response
        data = response.json()

        # Print something from the response (example: asset registry path)
        print("Received Data:", data)
    else:
        print(f"Failed to retrieve data. HTTP Status Code: {response.status_code}")

except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")
except Exception as e:
    print(f"An error occurred: {e}")

Call the function

get_unreal_data()

Failed to retrieve data. HTTP Status Code: 404

I have tried going through the documentation and been beating my head off the wall on this for a few days, Does anyone know what I’m doing wrong? or is there something I’m missing?

2 posts - 1 participant