Skip to main content

Python client library for the Rock, Paper, Code! app public API

Project description

rpsa-client

A Python client library for the RPSA public API.

Installation

# Via pip
pip install rpsa-client

# Or with Poetry
poetry add rpsa-client

Quickstart

from rpsa_client import RPSAClient, exceptions

# Initialize the client
client = RPSAClient(
    api_key="YOUR_API_KEY",
    base_url="https://rockpapercode.onespire.hu/api/v1/public"
)

# List arenas
resp = client.list_arenas(page=1, per_page=10)
for arena in resp.data:
    print(arena.id, arena.created_at)

# Get arena details
arena = client.get_arena(arena_id=1)
print(arena)

# Fetch game results
results = client.get_game_results(game_id=42)
for r in results:
    print(r.strategy_name, r.score)

# Strategy summary
summary = client.get_strategy_summary(strategy_id=7)
print(summary.total_score)

# Always close client when done
client.close()

Error handling

  • UnauthorizedError (401)
  • NotFoundError (404)
  • BadRequestError (400)
  • RateLimitError (429)
  • Generic APIError for other statuses.

Testing

poetry install
poetry run pytest

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

rpsa_client-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

rpsa_client-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file rpsa_client-0.1.0.tar.gz.

File metadata

  • Download URL: rpsa_client-0.1.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.1 Windows/10

File hashes

Hashes for rpsa_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a736cd1fcda65dc52376cd2d798d60ecaba180ce9328aae84795d30ef0bf7e39
MD5 5872004ebc7b2069327e7bef2414fee5
BLAKE2b-256 e30b9647244dca2636c519a393caa762840c11033f1fc3ec84de91caa6d2db9c

See more details on using hashes here.

File details

Details for the file rpsa_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rpsa_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.1 Windows/10

File hashes

Hashes for rpsa_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed7aab3f3866a6d458c873d999c2d73af64f8b8e12bbbcbd217e992cda535c66
MD5 883954b9c0f99f7bef36d7f55e0aee52
BLAKE2b-256 da78766818133954bc40ca2483654808f7108e6c8094ae22cb25fc1c889b4150

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