Skip to content

An asynchronous Python wrapper over the BattlEye RCON protocol.

License

Notifications You must be signed in to change notification settings

thegamecracks/berconpy

Repository files navigation

berconpy

PyPI Docs

An asynchronous Python wrapper over the BattlEye RCON protocol.

Usage with Arma Reforger

If you are only interested in RCON for Arma 3 / DayZ, you may safely ignore this section.

Currently, a preliminary rewrite of this library exists to provide some degree of support for Arma Reforger. See issue #7 for information on how to install it. Note that the official documentation is not updated to cover this rewrite, so most documented classes and methods will exist under different names.

Features

  • Easy to use event-based interface
  • Automatic network loss recovery
  • Included extension for using Arma-related commands

Basic Usage

import asyncio
import berconpy

client = berconpy.AsyncRCONClient()

IP = "XXX.XXX.XXX.XXX"
PORT = 9999
PASSWORD = "ASCII_PASSWORD"

@client.dispatch.on_login
async def on_login():
    print("We have logged in!")

async def main():
    async with client.connect(IP, PORT, PASSWORD):
        players = await client.send_command("players")
        print(players)

asyncio.run(main())

See the documentation for more details.

Installation

(Python 3.10 or higher is required)

This package can be installed from PyPi using the following command:

# Linux/macOS
python3 -m pip install berconpy

# Windows
py -m pip install berconpy

If you want to install the development version instead, and you have git installed:

pip install git+https://github.com/thegamecracks/berconpy

Related resources

License

This project uses the MIT License.