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.0.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.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: open5e_client-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 b74005dc67b4e482348321d7dd59a309b409e359298a9d07b7c4369be305a06d
MD5 3efe2cbf9915df7c0370b879439d28e0
BLAKE2b-256 1ef4673d0acd0b1f9d72cb7605d91be60bac4645526eadba48d23c1babb5bfed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: open5e_client-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3c92452b2b68f459f9e2456476c831112d214fad416127518bc8231a137f3ff
MD5 11915e20d17c8cec432e1ff4464278c7
BLAKE2b-256 31d49f88f1eb2b7e8acde3aa93aee025232264e97df33b1775cd4582bde17d2b

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