A simple, intuitive Python SDK for interacting with the Police Roleplay Community (PRC) API.
- Simple, intuitive interface for all PRC API endpoints
- Automatic rate limit handling
- Detailed error information
- Type hints for better IDE integration
- Comprehensive documentation and examples
pip install prc_sdkThe SDK requires a server key for authentication. You can obtain this key from your private server settings in the game.
from prc_sdk import PrcClient
# Initialize with your server key
client = PrcClient(server_key="your-server-key")
# Optionally, you can provide a global API key if you have one
client = PrcClient(
server_key="your-server-key",
api_key="your-global-api-key"
)# Get basic server information
status = client.get_server_status()
print(f"Server Name: {status.name}")
print(f"Players: {status.current_players}/{status.max_players}")# Get all players currently in the server
players = client.get_players()
for player in players:
print(f"Player: {player.name} | Team: {player.team}")# Run a command in the server
response = client.execute_command(":h Hello from the Python SDK!")
if response.success:
print("Command executed successfully")# Get all vehicles in the server
vehicles = client.get_vehicles()
for vehicle in vehicles:
print(f"Vehicle: {vehicle.name} | Owner: {vehicle.owner}")get_server_status()- Get basic server informationget_players()- Get all players in the serverget_join_logs()- Get server join logsget_queue()- Get players in queueget_kill_logs()- Get kill logsget_command_logs()- Get command logsget_mod_calls()- Get moderator call logsget_bans()- Get server bansget_vehicles()- Get vehicles in the server
execute_command(command)- Execute a command as "virtual server management"
The SDK automatically handles rate limits by respecting the headers provided by the API. If a rate limit is hit, the SDK will wait the appropriate time before retrying the request.
You can configure how the SDK handles rate limits:
from prc_sdk import PrcClient, RateLimitBehavior
client = PrcClient(
server_key="your-server-key",
rate_limit_behavior=RateLimitBehavior.WAIT_AND_RETRY # Default
)
# Other options:
# - RateLimitBehavior.RAISE_EXCEPTION
# - RateLimitBehavior.RETURN_ERRORThe SDK provides detailed error information via exceptions:
from prc_sdk import PrcClient, PrcApiError
client = PrcClient(server_key="your-server-key")
try:
status = client.get_server_status()
except PrcApiError as e:
print(f"Error Code: {e.error_code}")
print(f"Message: {e.message}")
print(f"HTTP Status: {e.status_code}")This project is licensed under the MIT License - see the LICENSE file for details.
This repository is maintained by @zenturocloud and is not accepting code requests. However, suggestions and feedback are welcome through issues.
Not affiliated with or endorsed by Roblox or Police Roleplay Community.