Library to query Minecraft server data
Project description
RStatus
RStatus is a Python library designed to query Minecraft server data, supporting both Java and Bedrock servers. It provides a unified API to retrieve server information, including server status, player counts, MOTD, version details, and more. The library also features DNS resolution and proxy support, making it easy to handle both domain names and direct IP addresses.
Features
- Unified API: Retrieve data from both Java and Bedrock servers.
- Automatic DNS Resolution: Resolve domain names to IP addresses with custom port detection.
- Proxy Support: Connect via SOCKS4/5 proxies for enhanced network flexibility.
- Bot Response: Get the server's bot response (Java only) to retrieve additional status details.
- Customizable Settings: Configure timeouts, enable BungeeCord compatibility, and debug mode for troubleshooting.
Installation
Install RStatus using pip:
pip install rstatus
Note: RStatus depends on external libraries PySocks and dnspython. These will be installed automatically.
Usage
Below is a basic example of how to use RStatus to query a Minecraft server:
from rstatus import RStatusClient
# Create a client instance for the target server (domain or IP:port)
client = RStatusClient("example.com:25565", debug=True)
# Get the server status (tries Java first, falls back to Bedrock)
server_data = client.get_server_data(bot=True)
if server_data:
print("Server Data:", server_data)
else:
print("Failed to retrieve server data.")
Querying Specific Server Types
-
Java Server Data
To query data specifically from a Java server, use:
java_data = client.get_java_server_data(bot=True) if java_data: print("Java Server Data:", java_data) else: print("Java server query failed.")
-
Bedrock Server Data
For Bedrock servers, use:
bedrock_data = client.get_bedrock_server_data() if bedrock_data: print("Bedrock Server Data:", bedrock_data) else: print("Bedrock server query failed.")
-
Bot Response (Java Only)
Retrieve the bot response from a Java server with an optional version parameter:
bot_response = client.get_bot_response(version="1.16") print("Bot Response:", bot_response)
API Reference
RStatusClient
The main class provided by RStatus is RStatusClient, which inherits functionality from the underlying MinecraftClient, JavaHandler, and BedrockHandler.
Constructor
RStatusClient(
target: str,
timeout: int = 5,
bungeehack: bool = False,
proxy_type: Optional[str] = None,
proxy_address: Optional[str] = None,
proxy_port: Optional[int] = None,
debug: bool = False,
) -> None
target: The target server address. It can be a domain (e.g.,"example.com") or include a port (e.g.,"example.com:25565").timeout: Connection timeout in seconds (default is 5).bungeehack: Enable compatibility with BungeeCord (default isFalse).proxy_type,proxy_address,proxy_port: Settings to connect via a proxy (supports SOCKS4/SOCKS5).debug: Enable debug logging for troubleshooting.
Methods
-
get_server_data(bot: bool = True) -> Union[JavaServerResponse, BedrockServerResponse, None]
Retrieves the status of the server. It first attempts a Java server query and, if unsuccessful, falls back to querying a Bedrock server. -
get_java_server_data(bot: bool = True) -> Optional[JavaServerResponse]
Specifically queries a Java server for its status data. -
get_bedrock_server_data() -> Optional[BedrockServerResponse]
Queries a Bedrock server for its status data. (Note: If the port is set to 25565, it automatically switches to the default Bedrock port 19132.) -
get_bot_response(version: Union[str, int, None] = None) -> str
Retrieves the server’s bot response for Java servers. You can optionally specify a server version.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file 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 rstatus-0.0.2.tar.gz.
File metadata
- Download URL: rstatus-0.0.2.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7447fbdfa931818ab3166c248ccae5e8a84eb9d8814bf377a12f0795a71d46ba
|
|
| MD5 |
100492ad92a9645601f2fd88dd576210
|
|
| BLAKE2b-256 |
67cd20eef6b8f7822be48ea869e8675b3fa28a3b90e0ac0e6299ceb88c58062a
|
File details
Details for the file rstatus-0.0.2-py3-none-any.whl.
File metadata
- Download URL: rstatus-0.0.2-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d19a3b17c2e6ae46547a8e499c95a8f39e973c9f79007697f46dbe3d53336f78
|
|
| MD5 |
8ece8775ba95d23056c9ad46a7b7c00d
|
|
| BLAKE2b-256 |
451814ebff2741ae42cd8fffcc506f4e420de979dba454679cf4bccb6764b15d
|