A Python SDK for interacting with the PRC API
Project description
PRC API SDK for Python
A simple, intuitive Python SDK for interacting with the Police Roleplay Community (PRC) API.
📋 Features
- 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
🚀 Installation
pip install prc-sdk
🔑 Authentication
The 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"
)
🌟 Quick Examples
Get Server Status
# 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 Players in Server
# Get all players currently in the server
players = client.get_players()
for player in players:
print(f"Player: {player.name} | Team: {player.team}")
Execute Command
# Run a command in the server
response = client.execute_command(":h Hello from the Python SDK!")
if response.success:
print("Command executed successfully")
Get Vehicle Information
# Get all vehicles in the server
vehicles = client.get_vehicles()
for vehicle in vehicles:
print(f"Vehicle: {vehicle.name} | Owner: {vehicle.owner}")
📚 Available Methods
Server Information
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
Server Actions
execute_command(command)- Execute a command as "virtual server management"
🚨 Rate Limits
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_ERROR
❓ Error Handling
The 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}")
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🛠️ Maintenance
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.
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 prc_sdk-0.1.1.tar.gz.
File metadata
- Download URL: prc_sdk-0.1.1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
926f29f8686b648d992d40611296e9540c7c3e10b13284e379d574ed351c9314
|
|
| MD5 |
36995638553087ef8f09eefe7146ccc8
|
|
| BLAKE2b-256 |
d91c24d9407611cdee58af88e837f1f33e3e811c58b6d3f17d75125d83ed4bac
|
File details
Details for the file prc_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: prc_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c1e84dc9ec5c56a2cc7856e686834908775753bf15ba063d72e1e9110acf650
|
|
| MD5 |
df659ffc4ad40cfd331d1e00ca6f3fdf
|
|
| BLAKE2b-256 |
36a7b29891dc6eb8bb8cad7662193c1b8972495e1e3811c3145505a08da82397
|