Skip to main content

A modern asynchronous client for the Wizard101 Wiki.

Project description

WizWiki v0.1.4

WizWiki logo

Tests PyPI version License

A modern, high-performance, asynchronous Python library designed to scrape and query the Wizard101 Wiki with precision and ease for python 3.11+.


Features

  • 🚀 Asynchronous API: Fully non-blocking I/O using asyncio, ensuring your applications remain responsive.
  • 🛡️ Cloudflare Bypass: Integrated with cloudscraper to seamlessly navigate through Wiki protection.
  • 🏗️ Structured Models: Powered by Pydantic V2, providing rigorous type validation and excellent IDE support.
  • 💧 Lazy Loading: Thin "View" models for quick index browsing that can be promoted to full "Resource" objects on-demand.
  • ⚔️ Battle Insights: Detailed parsing of Creature battle stats, including pips, boosts, and resistances.
  • 📦 Categorized Drops: Automatically groups gear, spells, and reagents into searchable dictionaries.

Architecture: View & Resource Models

WizWiki uses a specialized dual-model system to maintain high performance and low memory overhead:

  • View Models (View): When a resource is returned as part of a collection (e.g., an item dropped by a boss), it is instantiated as a lightweight View object (like ItemView). These objects contain only basic identification data (name, category, url) and do not fetch the full wiki page immediately.
  • Resource Models (Resource): These are the full-fidelity objects (like Item, Creature, Spell). They contain all extracted fields and detailed information.
  • Lazy Promotion: You can "promote" any View into a full Resource by calling awaiting its .get() method. This seamlessly triggers a web request to parse the full page only when you explicitly need the data.

Under The Hood

  • Engine (cloudscraper): Many components of the Wiki are protected by Cloudflare. WizWiki uses cloudscraper to handle these challenges automatically, wrapping them in an asynchronous execution layer to prevent event-loop blocking.
  • Parsing (BeautifulSoup4): We use specialized heuristics to parse the Wiki's complex HTML structure. Our parsing logic is encapsulated within the models themselves, allowing for specialized extraction of stats, locations, and drops.
  • Data Integrity (Pydantic): Every piece of data is validated against strict schemas. This means you get a consistent API and predictable objects every time you query a resource.

Installation

pip install wizwiki

Quick Start

import asyncio
from wizwiki import WizWikiClient

async def main():
    client = WizWikiClient()
    
    # Fetch a creature (and its minions)
    creature = await client.get_creature("Malistaire Drake")
    print(f"Name: {creature.name} (Health: {creature.health})")
    
    # Access structured Battle Stats
    stats = creature.battle_stats
    print(f"Starting Pips: {stats.starting_pips}")
    print(f"Resistances: {stats.incoming_resist}")
    
    # Promote a dropped item 'View' to a full 'Resource'
    if "Hats" in creature.drops:
        hat_view = creature.drops["Hats"][0]
        hat = await hat_view.get() # Unified lazy loading
        print(f"Full Item Detail: {hat.name}")

if __name__ == "__main__":
    asyncio.run(main())

Supported Categories

  • Creatures: Stats, Drops, Locations, and Minions.
  • Spells: School, Accuracy, and Effect parsing.
  • Items: Gear, Decks, and Wands.
  • Reagents, Jewels, & Housing: Full resource identification.

CI/CD & Quality

WizWiki is tested across Ubuntu, Windows, and macOS using tox and GitHub Actions, ensuring compatibility across Python 3.11, and 3.12.

License

This project is licensed under the MIT License.

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

wizwiki-0.1.4.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

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

wizwiki-0.1.4-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file wizwiki-0.1.4.tar.gz.

File metadata

  • Download URL: wizwiki-0.1.4.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wizwiki-0.1.4.tar.gz
Algorithm Hash digest
SHA256 462224a1a4858e27c570c3c94ce036159e3752021280f49013c2a2d4932b857c
MD5 422f26ceb8c348a317d76d1995b078a3
BLAKE2b-256 fa452b6d29d592a0d03778bd9bcd4bd4db0b1a52f2a736d2d4ed5d1978ca58d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for wizwiki-0.1.4.tar.gz:

Publisher: publish.yml on Angle-Brackets/WizWiki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wizwiki-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: wizwiki-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wizwiki-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 054b612aac33d1f9eb6b45b99b25e313f3bd0059c3e3571400e36bfffd9eb288
MD5 5c141ebfee7a0bf84db7e9b2ced51ea5
BLAKE2b-256 2321d61d51fa42f83b50c0c528f009922a233a3273d0495cbfab25cf2ce2283d

See more details on using hashes here.

Provenance

The following attestation bundles were made for wizwiki-0.1.4-py3-none-any.whl:

Publisher: publish.yml on Angle-Brackets/WizWiki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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