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
APIErrorfor other statuses.
Testing
poetry install
poetry run pytest
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
rpsa_client-0.1.1.tar.gz
(10.2 kB
view details)
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 rpsa_client-0.1.1.tar.gz.
File metadata
- Download URL: rpsa_client-0.1.1.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec515e540f35ddbaa0d79911ee3f92d491bbd0038dd271c3bd75a22bf5ee5dd5
|
|
| MD5 |
f94059b209360ecc75088099a1b3473f
|
|
| BLAKE2b-256 |
0925ab3897a3e616d9d1ebce25b10fec635c861aa2632c846d73b05ab484f05e
|
File details
Details for the file rpsa_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: rpsa_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5020dd438879af549fc8588f151d0cbb13d37f911da98a099d35de2fb32afbb8
|
|
| MD5 |
7af98316189b2799f290c4e60d8e2b17
|
|
| BLAKE2b-256 |
b88ad99d74bf278c0f8f061360c5e59aee7e54a3518afb87f69170d7caaade16
|