Skip to main content

Python wrapper for the Oxford Response API

Project description

oxrpy

A Python wrapper for the Oxford Response API.

Installation

Install from PyPI:

pip install oxrpy

Or from source:

pip install -r requirements.txt

Usage

from oxrpy import OxfordAPI

# Initialize with your server ID and key
api = OxfordAPI(server_id="your_server_id", server_key="your_server_key")

# Use all methods directly
server_info = api.get_server()

# Or use grouped managers
servers = api.servers
server_info = servers.get_server()
players = servers.get_players()

logs = api.logs
kill_logs = logs.get_killlogs()

commands = api.commands
result = commands.execute_command("announce Hello!")

You can also import the managers directly:

from oxrpy import Servers, Logs, Commands

servers = Servers(api)
logs = Logs(api)
commands = Commands(api)

Features

  • Automatic rate limiting (5 requests per second max)
  • Comprehensive error handling with custom exceptions
  • Request timeouts
  • Logging support
  • Input validation

Supported Endpoints

  • get_server(): Returns general server information.
  • get_players(): Returns list of current players.
  • get_queue(): Returns the reserved server queue.
  • get_bans(): Returns active bans.
  • get_killlogs(): Returns recent kill logs (max 100 entries).
  • get_commandlogs(): Returns recent command execution logs.
  • get_modcalls(): Returns recent moderator call requests.
  • get_vehicles(): Returns vehicles currently spawned.
  • execute_command(command): Executes a permitted command (e.g., "announce Hello!").

API Endpoints

get_server(): Returns general server information. Example response:

{
  "Name": "Oxford Roleplay",
  "StyledName": "Oxford RP",
  "Description": "UK emergency roleplay server",
  "Tags": ["UK", "RP"],
  "ThemeColour": "#ffffff",
  "OwnerId": 123456789,
  "CurrentPlayers": 18,
  "MaxPlayers": 32,
  "JoinCode": "OXFD-ABCD",
  "CreatedAt": 1700000000,
  "Packages": []
}

get_players(): Returns list of current players. Example response:

[
  {
    "Username": "PlayerOne",
    "DisplayName": "PlayerOne",
    "UserId": 12345,
    "Team": "Civilian",
    "WantedLevel": 0,
    "Permission": "Admin",
    "Callsign": "A12",
    "Location": "Near Oxford City Centre"
  }
]

get_queue(): Returns the reserved server queue. Example response:

{
  "total": 2,
  "users": [12345, 67890]
}

get_bans(): Returns active bans. Example response:

[
  {
    "UserId": 12345,
    "Username": "BannedUser",
    "Reason": "Fail RP",
    "BannedBy": "API",
    "BannedById": 2,
    "Expiry": 1701000000
  }
]

get_killlogs(): Returns recent kill logs (maximum 100 entries). Example response:

[
  {
    "Timestamp": 1700000100,
    "KillerUserId": 123,
    "KillerUsername": "OfficerA",
    "VictimUserId": 456,
    "VictimUsername": "SuspectB",
    "Distance": 42,
    "Weapon": "Taser"
  }
]

get_commandlogs(): Returns recent command execution logs. Example response:

[
  {
    "Timestamp": 1700000200,
    "UserId": 789,
    "Username": "AdminUser",
    "Command": "kick",
    "Args": ["PlayerOne"]
  }
]

get_modcalls(): Returns recent moderator call requests. Example response:

[
  {
    "Timestamp": 1700000300,
    "CallerUserId": 123,
    "CallerUsername": "PlayerOne",
    "CallerDisplayName": "Player One",
    "CaseId": "CASE-001",
    "Responders": [
      {
        "UserId": 789,
        "Username": "ModeratorA"
      }
    ]
  }
]

get_vehicles(): Returns vehicles currently spawned in the server. Example response:

[
  {
    "OwnerUserId": 123,
    "OwnerUsername": "PlayerOne",
    "Registration": "OX12 ABC",
    "Model": "Volvo XC90",
    "Electric": false,
    "ELS": true,
    "ELS_Style": "UK"
  }
]

execute_command(command): Executes a permitted command on the server. Example response:

{
  "message": "Command sent successfully"
}

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

oxrpy-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

oxrpy-1.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file oxrpy-1.0.0.tar.gz.

File metadata

  • Download URL: oxrpy-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for oxrpy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cc9a65a54c39f2de88513ced8bf3dd7ee8df212cd8f229d2f1be79f31d0178e8
MD5 88b07774420e07cb83088fd1b4d555eb
BLAKE2b-256 fb92b4fb6581b9b0f70a42bf312b1d75dc5716a2d2279780ac7b3b7d19f4494f

See more details on using hashes here.

File details

Details for the file oxrpy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: oxrpy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for oxrpy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6539d827fd712d6a7d5d116f45d2ecdcf228fa0d36b08d898891c19a81ab9e66
MD5 3f9791fb5d1944340ffab143a5accf4c
BLAKE2b-256 c281a4bda2c9f7f1dfdae71551a8ef85ab89d60b9125ff016eeaf8a803917c1f

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