Skip to main content

A Python SDK for interacting with the PRC API

Project description

PRC API SDK for Python

PRC API License 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 information
  • get_players() - Get all players in the server
  • get_join_logs() - Get server join logs
  • get_queue() - Get players in queue
  • get_kill_logs() - Get kill logs
  • get_command_logs() - Get command logs
  • get_mod_calls() - Get moderator call logs
  • get_bans() - Get server bans
  • get_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prc_sdk-0.1.2.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prc_sdk-0.1.2-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file prc_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: prc_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for prc_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 94b184503b6effcd19b44d4cfeb7bb672b3d56674a450678ea1a31148b9af1bb
MD5 c82bb64969a101d5753a2ed8f418ecaa
BLAKE2b-256 87b83da3cda662cb6e8a4fbdb6bee17c6e9e7fa09e04549c10533101a84c084f

See more details on using hashes here.

File details

Details for the file prc_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: prc_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for prc_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84448dd4e2ace1502d8ecb0793140451924041fa3937dce0c117fa17a557ba85
MD5 d689a738ead73d0d9b95c6208b7ace9a
BLAKE2b-256 ce13ea3f1a78dfe4ef832f575c10eadfc33005982fec88200ed789136aada112

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page