Skip to main content

Official Python client for the Createrington Skin API.

Project description

createrington-skin-api

Official Python client for the Createrington Skin API. Renders Minecraft player skins into named poses and returns PNG bytes. Sync and async clients, fully typed.

pip install createrington-skin-api

Access is invite-only. Request an API key at https://api.createrington.com.

Quickstart

from createrington_skin_api import SkinApiClient

client = SkinApiClient(api_key="sk_...")  # or set SKIN_API_KEY

# Render a known pose for a Minecraft account by UUID.
png = client.render("wave", uuid="069a79f444e94726a5befca90e38aaf5")

# `png` is `bytes` of a PNG image.
with open("notch-waving.png", "wb") as f:
    f.write(png)

Async

import asyncio
from createrington_skin_api import AsyncSkinApiClient


async def main() -> None:
    async with AsyncSkinApiClient(api_key="sk_...") as client:
        png = await client.render("wave", username="Notch", slim=True)
        with open("notch-waving.png", "wb") as f:
            f.write(png)


asyncio.run(main())

Client

SkinApiClient(
    api_key=None,          # required; falls back to the SKIN_API_KEY env var
    base_url="https://api.createrington.com",
    timeout=30.0,          # seconds
    retries=2,             # retries 429/502/503/504 and network errors
    user_agent="createrington-skin-api",
)

AsyncSkinApiClient takes the same arguments. Both are usable as context managers (with / async with) and expose close() / aclose() for explicit cleanup of the underlying connection pool.

render

client.render(
    pose,                  # a KNOWN_POSES name (e.g. "wave"), or any pose string
    *,
    # exactly one skin source:
    uuid=None,             # Mojang UUID, resolved server-side
    username=None,         # Mojang username, resolved server-side
    skin_url=None,         # public URL to a 64x64 PNG
    skin_base64=None,      # base64-encoded 64x64 PNG (data URL prefix optional)
    png=None,              # raw 64x64 PNG bytes, sent as multipart/form-data
    # options:
    slim=None,             # override slim/Alex arm geometry; default uses skin metadata
    width=None,            # default 400 (64..2048)
    height=None,           # default 600 (64..2048)
) -> bytes

Exactly one skin source must be supplied; passing none or more than one raises ValueError.

pose accepts any string, so server-side poses added after this release work without an SDK upgrade. The bundled KNOWN_POSES tuple and KnownPose type cover the poses known at publish time; fetch GET /v1/poses directly if you need the live catalogue with descriptions.

from createrington_skin_api import KNOWN_POSES, KnownPose

Errors

Every non-2xx response (and network/timeout failures) raises SkinApiError:

from createrington_skin_api import SkinApiError

try:
    client.render("wave", uuid="bad-uuid")
except SkinApiError as err:
    print(err.code, err.status, err)
    if err.code == "rate_limited" and err.retry_after_ms:
        ...  # back off and retry

err.code is one of "bad_request", "unauthorized", "forbidden", "not_found", "conflict", "unsupported_media_type", "rate_limited", "internal", "render_failed", "upstream_unavailable", "timeout", "aborted", "network_error", "unknown". err.status is the HTTP status (or 0 for network/timeout failures). err.retry_after_ms is populated on 429 responses when the server reports it.

The client retries 429, 502, 503, 504, and network errors up to retries times with exponential backoff; 429 responses honour the server's retryAfterMs when present.

License

UNLICENSED. See repository for terms.

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

createrington_skin_api-1.0.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

createrington_skin_api-1.0.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for createrington_skin_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 71c811b9c2d44dfa6071a51051f2af829f48afca5186fcef139330f0a94efd8f
MD5 ea4ee95ff40c3361e3f2be29e4d16800
BLAKE2b-256 4a9295d3a09d6cd4454927e85d6875b092db9480f87aedb8d5792095ba0dedab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for createrington_skin_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a134a2080f3053715c0ac8d104894d6466c9caf11a054461781cfdbf02a5efb
MD5 620bd4c776ccb58216cae9fd3ffb0eff
BLAKE2b-256 7b7c1ff17705e874c7c209eb96360214021ba1a8c83c574bc2de24cd97627421

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