Skip to main content

A lightweight Python client for the Open5e API

Project description

Open5e Client

Open5e Python Client

This is a small Python wrapper for the Open5e API.
This package has dataclasses that allow the uses to look up spells, monsters, classes, races, and magic items from the 5e System Reference Document and other Open5e-supported content. In future iterations I may add feats and subclasses.


Overview

The Open5e API provides 5e rules content in a structured JSON format.
This client wraps that API and provides:

  • Python dataclasses for each resource
  • Methods like
    list_spells(), list_monsters(), get_spell("fireball"), etc.
  • Pagination helpers:
    list_all_spells(), list_all_monsters(), etc.
  • Pandas dataframe utilities such as
    spells_dataframe(), monsters_dataframe(), etc.

Features

  • Query spells, monsters, classes, races, and magic items
  • Retrieve single entries by name or slug
  • Fetch all paginated results automatically
  • Convert results to pandas DataFrames for analysis
  • Dataclass models capture all known fields + flexible “extras”
  • Built using requests and standard Python libraries

Installation

Clone the repository and install in editable mode:

git clone <your_repo_url>
cd open5e_client_project
python -m pip install -e .

##QUICK START

from open5e_client import Open5eClient

client = Open5eClient()

# List first 5 evocation spells
spells = client.list_spells(school="Evocation", limit=5)
for s in spells:
    print(s.name, s.level)

# Retrieve a single monster
dragon = client.get_monster("adult-blue-dragon")
print(dragon.name, dragon.armor_class)


##USAGE EXAMPLES

spells = client.list_spells(level=3)
fireball = client.get_spell("fireball")
all_spells = client.list_all_spells()

##Dataframes 

df_spells = client.spells_dataframe()

#PROJECT STRUCTURE

open5e_client_project/
│
├── open5e_client/
│   ├── __init__.py
│   ├── client.py
│   ├── models.py
│   └── ...
│
├── tests/
│   └── (optional pytest files)
│
├── examples/
│   └── open5e_demo.ipynb
│
└── README.md

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

open5e_client-0.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

open5e_client-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file open5e_client-0.1.1.tar.gz.

File metadata

  • Download URL: open5e_client-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for open5e_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0a8daad9ecd20b6f9741d0381ad0856c543cbf01df9e49277b596cc6d399ed2e
MD5 0028f4838383496db4a3e295d4e9d782
BLAKE2b-256 be1d5df6fe8df9b50cbe6116d0492fe505713063a52b67e3c9f8694f8c0a5e30

See more details on using hashes here.

File details

Details for the file open5e_client-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: open5e_client-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for open5e_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 edb58470faf4dccb4e88b57a9a5ad877547dc3e7ddb4b80a9e50eba86edf12f5
MD5 b56188d3afb26c58d78a5c1c2f8981a1
BLAKE2b-256 f760d1415a5b84688f3823c1ac8fa70c5b8f3972e5a9dd17ca49649d8ad1fe01

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