Skip to main content

A modern asynchronous client for the Wizard101 Wiki.

Project description

WizWiki v0.1.3

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.3.tar.gz (22.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.3-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wizwiki-0.1.3.tar.gz
  • Upload date:
  • Size: 22.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.3.tar.gz
Algorithm Hash digest
SHA256 a48860fd699ee137f38b195f6da08e5d85daf9a7907929df6597764d330135f6
MD5 55a3f83f50e73b7cd955fde900d62fd1
BLAKE2b-256 5d3d336b34a9f92b8fe82cf6f3e311064307432ba650d64597967dac76d7f911

See more details on using hashes here.

Provenance

The following attestation bundles were made for wizwiki-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: wizwiki-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 23.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1564e48c9f442b592de71853fddc785e1164e0769764f5337ad8ef5e197fe6d3
MD5 53c5a02a6be4131a0840e9fdfde8d21d
BLAKE2b-256 53ebb4d4d0c0c9d1de7b63e1c8d2f57db15962043c12d853054b6f6e83f0118e

See more details on using hashes here.

Provenance

The following attestation bundles were made for wizwiki-0.1.3-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