Factorio RCON Client

raw JSON →
2.1.3 verified Fri May 01 auth: no python

A simple Python client for communicating with a Factorio game server via the RCON protocol. Latest version 2.1.3 supports Python >=3.8. Released as needed.

pip install factorio-rcon-py
error ModuleNotFoundError: No module named 'factorio_rcon'
cause Library not installed or installed under a different name.
fix
Run 'pip install factorio-rcon-py'.
error ConnectionRefusedError: [Errno 111] Connection refused
cause Server is not running, RCON not enabled, or wrong IP/port.
fix
Verify server is running with RCON enabled and correct port (default 27015).
gotcha Connecting to a remote server may fail due to firewall or incorrect port. Default Factorio RCON port is 27015.
fix Ensure the server is reachable and the port is open.
gotcha The client does not automatically reconnect. If the connection drops, create a new RCONClient instance.
fix Wrap RCONClient usage in a retry logic or recreate the client on failure.

Connect to a Factorio server, send an RCON command, and print the response.

from factorio_rcon import RCONClient

client = RCONClient('127.0.0.1', 27015, 'password')
response = client.send_command('/players')
print(response)