Asynchronous implementation of the Hell Let Loose RCON protocol
Project description
hllrcon - Hell Let Loose RCON
hllrcon is an asynchronous Python implementation of the Hell Let Loose RCON protocol.
It allows you to interact with your HLL servers programmatically, supporting modern Python async features and robust error handling.
Features
- Full async/await support
- Command execution and response parsing
- Collection of vanilla maps, factions, weapons, and more
- Alternative interfaces for synchronous applications
- Well-typed and tested
Installation
pip install hllrcon
Usage
import asyncio
from hllrcon import Rcon, Layer
async def main():
# Initialize client
rcon = Rcon(
host="127.0.0.1",
port=12345,
password="your_rcon_password",
)
# Send commands. The client will (re)connect for you.
await rcon.broadcast("Hello, HLL!")
await rcon.change_map(Layer.STALINGRAD_WARFARE_DAY)
players = await rcon.get_players()
# Close the connection
rcon.disconnect()
# Alternatively, use the context manager interface to avoid
# having to manually disconnect.
async with rcon.connect():
assert rcon.is_connected() is True
await rcon.broadcast("Hello, HLL!")
if __name__ == "__main__":
# Run the program
asyncio.run(main())
For integration of synchronous applications, a SyncRcon class is provided.
from hllrcon.sync import SyncRcon
rcon = SyncRcon(
host="127.0.0.1",
port=12345,
password="your_rcon_password",
)
# Connect and send a broadcast message
with rcon.connect():
rcon.broadcast("Hello, HLL!")
The library contains a swathe of details about in-game maps, factions, weapons, vehicles, and more. Below is just an example of what it might be used for.
from hllron import Weapon
# Find a weapon by its ID
weapon_id = "COAXIAL M1919 [Stuart M5A1]"
weapon = Weapon.by_id(weapon_id)
# Print out whichever vehicle seat the attacker must have been in, if any
if weapon.vehicle:
for seat in weapon.vehicle.seats:
if weapon in seat.weapons:
print("This weapon belongs to the", seat.type.name, "seat")
break
from hllrcon import Rcon, Map, Team
# Get the AA Network capture zone (SMDM, 3rd sector, 2nd capture zone)
sector = Layer.STMARIEDUMONT_WARFARE_DAY.sectors[2]
capture_zone = sector.capture_zones[1]
assert capture_zone.strongpoint.name == "AA Network"
# Get the current online players
rcon = Rcon(...)
players = await rcon.get_players()
# Calculate each team's capture strength towards the sector
strength = {Team.ALLIES: 0, Team.AXIS: 0}
for player in players.players:
if player.faction is None:
continue
if player.world_position == (0.0, 0.0, 0.0):
# Player is dead. Note: Does not exclude players bleeding out
continue
# Grant 3 strength if inside the strongpoint
if capture_zone.strongpoint.is_inside(player.world_position):
strength[player.faction.team] += 3
# Only grant 1 strength if inside the capture zone
elif capture_zone.is_inside(player.world_position):
strength[player.faction.team] += 1
# Print out the results
print("Allied cap weight:", strength[Team.ALLIES])
print("Axis cap weight:", strength[Team.AXIS])
Versioning
Hell Let Loose (referred to as "the game") is a constantly evolving game, and game updates might alter its RCON interfaces in ways that are not backward-compatible. This affects any tools and libraries that depend on it, including this library and any software utilizing it.
Releases of hllrcon only guarantee compatibility with the latest version of the game at the time of release. See the release notes of a given version for more
information on what version this is.
This project uses its own versioning system similar to Pragmatic Versioning principles (i.e. GRADE.MAJOR.MINOR.PATCH).
However, there are differences in the way each of the four components are defined and what they guarantee:
GRADE- Reserved for structural changes. Likely to increase only with the release of Hell Let Loose: Vietnam.MAJOR- Incremented when backward-incompatible changes are released.MINOR- Incremented when support for the previously supported game version is dropped.PATCH- Incremented when backward-compatible changes are released.
When specifying hllrcon as a dependency, it is recommended to pin the MINOR version but not the PATCH version. MINOR versions are still backwards-incompatible
in that they require the game server to be updated. MINOR versions may depend on upcoming, unreleased game version.
License
This project is licensed under the MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hllrcon-1.1.0.0.tar.gz.
File metadata
- Download URL: hllrcon-1.1.0.0.tar.gz
- Upload date:
- Size: 146.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aee5d6d76bec2cd0497e2147efaea5956112ebc52d3371db884d8056ab6252f8
|
|
| MD5 |
7a3c2f4bf2e941aadbe6b33f97ddbae0
|
|
| BLAKE2b-256 |
aa0ab363c5cd9abb5fbeb9f1a0727bce36e08a007f0ed531e2f529ac7779a191
|
Provenance
The following attestation bundles were made for hllrcon-1.1.0.0.tar.gz:
Publisher:
python-publish.yaml on timraay/hllrcon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hllrcon-1.1.0.0.tar.gz -
Subject digest:
aee5d6d76bec2cd0497e2147efaea5956112ebc52d3371db884d8056ab6252f8 - Sigstore transparency entry: 907308378
- Sigstore integration time:
-
Permalink:
timraay/hllrcon@216f73618d37f768279292e7cb2d1bab1e6d7d46 -
Branch / Tag:
refs/tags/1.1.0.0 - Owner: https://github.com/timraay
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@216f73618d37f768279292e7cb2d1bab1e6d7d46 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hllrcon-1.1.0.0-py3-none-any.whl.
File metadata
- Download URL: hllrcon-1.1.0.0-py3-none-any.whl
- Upload date:
- Size: 81.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b560b2bcac73e35770692b73fcf454d3d6fdd7f08b0c99ac2e9421f5f0b016c1
|
|
| MD5 |
53001ea6255450ccc5a2feccf5c6a58c
|
|
| BLAKE2b-256 |
4f5474ef1f2ece1167c6fdfd80971452d19bbc67bb4662d37ef247d01bc361b1
|
Provenance
The following attestation bundles were made for hllrcon-1.1.0.0-py3-none-any.whl:
Publisher:
python-publish.yaml on timraay/hllrcon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hllrcon-1.1.0.0-py3-none-any.whl -
Subject digest:
b560b2bcac73e35770692b73fcf454d3d6fdd7f08b0c99ac2e9421f5f0b016c1 - Sigstore transparency entry: 907308404
- Sigstore integration time:
-
Permalink:
timraay/hllrcon@216f73618d37f768279292e7cb2d1bab1e6d7d46 -
Branch / Tag:
refs/tags/1.1.0.0 - Owner: https://github.com/timraay
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@216f73618d37f768279292e7cb2d1bab1e6d7d46 -
Trigger Event:
release
-
Statement type: