Tirsvad 213e176d29
TirSystem/git-workflows: CD / changes (push) Successful in 7s
TirSystem/git-workflows: CI / secret-scan (push) Successful in 8s
TirSystem/git-workflows: CI / validate (push) Successful in 19s
TirSystem/git-workflows: CI / opengrep (push) Successful in 45s
TirSystem/git-workflows: CI / release-check (push) Successful in 6s
TirSystem/git-workflows: CD / wait-for-ci (push) Successful in 1m19s
TirSystem/git-workflows: CD / release (push) Skipped
TirSystem/git-workflows: CD / publish-wiki (push) Skipped
TirSystem/git-workflows: CD / sync-metadata (push) Successful in 5s
TirSystem/git-workflows: CD / sync-milestones (push) Successful in 13s
Merge pull request 'Correct the ADR-0001 statement about PotterDB' (#32) from fix-adr-0001-potterdb into main
Reviewed-on: #32
2026-11-23 04:55:46 +01:00
2026-11-23 11:08:09 +08:00
2026-11-22 09:33:32 +01:00

🚀 Harry Potter Website (Day 96)

A small Flask website that shows Harry Potter characters from a public REST API. It is the Day 96 assignment of the course 100 Days of Code: The Complete Python Pro Bootcamp, written to be read, run and compared by other course participants.

📚 Table of Contents

🧭 Overview

The site lists characters, filters them by Hogwarts house and shows one character. The code follows a layered layout and each part has one job:

Folder Purpose
src/hp_site/domain/ The Character entity and the errors
src/hp_site/application/ The CharacterClient port the website depends on
src/hp_site/infrastructure/ The HTTP client for the public API, using only the standard library
src/hp_site/presentation/ The Flask controller, templates and styles
src/hp_site/constants.py Every shared constant
tests/ The pytest tests; they never call the network
docs/ Project documents, setup guide and screenshots

The lecture steps

Step 1. Choose an API. The lecture's Potter API is retired, so the site uses the Potter API by fedeperin. The choice is recorded in an architecture decision.

Step 1: the API answers with JSON

Step 2. Make the first request and show the data. The home page lists every character.

Step 2: all characters

Step 3. Filter by house. /house/<name> lists one house, for example /house/gryffindor.

Step 3: one house

Step 4. Show one character. /character/<id> shows the details.

Step 4: one character

Step 5. Handle a failing API. When the service is down, the visitor sees a clear message and status 503.

Step 5: the API is unavailable

The screenshots are taken with bash tests/e2e/capture.sh, which runs the site and a headless browser in Docker containers.

📋 Requirements

  • Python 3.14 or newer, because pyproject.toml requires it.
  • Flask is the only runtime dependency. The HTTP client uses the standard library.
  • pytest for the tests (installed by the dev extra).
  • Doxygen, only to build the API documentation.

🛠️ Setup

Create a local virtual environment, upgrade pip and install the project. On Windows (PowerShell):

py -3.14 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

On Linux and macOS:

python3.14 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

More detail, including the checks to run before a push, is in the setup guide.

▶️ Run

python -m hp_site

Open http://127.0.0.1:5000/. Build the API documentation with doxygen Doxyfile; the output goes to docs/doxygen/.

🧪 Tests

python -m pytest
python -m ruff check src tests
python -m mypy src

📄 License

This project is released under the license in LICENSE.

📎 Appendix: Project documents

The documents a newcomer needs, in reading order. Drop a line only when the project has no such document yet.

Document What it tells you
Business Case Why the project exists, its scope and success criteria
Stakeholder Analysis Who is involved; the stakeholder IDs used for owners and reviewers
Project Plan The gateways and their schedule
Milestones One document per gateway: Go/No-Go criteria and tasks
Artifact registry Where each artifact type lives, the next version, the PO language and domain
Framework README The framework this project uses
Framework changelog What changed in each framework release

S
Description
Day 96 of 100 Days of Code: a Flask website that shows Harry Potter characters from a public REST API. Python 3.14, pytest, one runtime dependency.
Readme AGPL-3.0
2.7 MiB
0 Stars 1 Watchers 0 Forks
Languages
Python 82.8%
HTML 8.1%
Shell 5.1%
CSS 4%