Giter VIP home page Giter VIP logo

factorio-rcon-py's Introduction

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:

License

LGPLv2.1

factorio-rcon-py's People

Contributors

mark9064 avatar desaleo avatar black-sliver avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.