Skip to main content

A simple Factorio RCON client

Project description

factorio-rcon-py

A simple Factorio RCON client

Install

Without async support pip install factorio-rcon-py

With async support pip install factorio-rcon-py[async]

Async support is available as soon as the required dependency (anyio) is installed, so pip install factorio-rcon-py anyio is mostly equivalent, but not recommended due to dependency versioning.

Python 3.8+ is required.

Usage

Example:

import factorio_rcon

client = factorio_rcon.RCONClient("127.0.0.1", 12345, "mypassword")
response = client.send_command("/help")

All documentation is in the docstrings of each class/method.

Asynchronous usage of this module is possible thanks to anyio. This means that you can use the async client with asyncio and trio. Use the AsyncRCONClient class. More details are in its docstring.

Available methods in both classes are (see docstrings for more info):

  • connect - Connects to the RCON server.
  • close - Closes the connection to the RCON server.
  • send_packet - Sends a packet to the RCON server.
  • receive_packet - Receives a packet from the RCON server.
  • send_command - Sends a single command to the RCON server.
  • send_commands - Sends multiple commands to the RCON server.

Note that both the sync/async clients can be used as sync/async context managers respectively.

The methods for sending/receiving packets are available in case you want to write your own packet handlers, but in most cases you will never need to touch these and can use send_command(s).

Mentions

Thanks to:

  • Truman Kilen for the initial code / idea.
  • De Sa Léo for contributing context manager support and typing improvements.

License

LGPLv2.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

factorio_rcon_py-2.1.3.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

factorio_rcon_py-2.1.3-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file factorio_rcon_py-2.1.3.tar.gz.

File metadata

  • Download URL: factorio_rcon_py-2.1.3.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

File hashes

Hashes for factorio_rcon_py-2.1.3.tar.gz
Algorithm Hash digest
SHA256 84bfc42d2adfcd01660bd403652c6453f6be2b474817e214e75206f02b1512c3
MD5 beadfc14b5c051c83a5d288cc029282c
BLAKE2b-256 2324ddb08445a3a00c4b106b81ee2b3b59061cd29ea8f4968ec33954adf1c46a

See more details on using hashes here.

File details

Details for the file factorio_rcon_py-2.1.3-py3-none-any.whl.

File metadata

  • Download URL: factorio_rcon_py-2.1.3-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

File hashes

Hashes for factorio_rcon_py-2.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ad2e73f5442cd1df235f435bf1079dd73eb62d1856d7526e4a0b6d4400b6cbb0
MD5 98e7a2ab07e536929a2a6849267ff54d
BLAKE2b-256 f5d6d100cca0fddea8241d44205e17c52b3b9b71ca4accf6db3fbe8262e27cc3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page