# GLAMWalk — Companion Scripts

**Navigating and Reusing Galleries, Libraries, Archives, and Museums with Python**
Source of Truth Publishing Co. — soretruth.com

This package contains every real, runnable code example from all five volumes of
GLAMWalk, organized by volume and numbered in the order each one appears in the
book. Read the matching chapter first — every script here is meant to be typed
along with, or downloaded and run directly, not read in isolation.

## How this package is organized

```
volume_1/   Foundations              — 10 scripts
volume_2/   The Gauntlet             — 10 scripts
volume_3/   Data at Scale            — 11 scripts
volume_4/   Libraries & Archives     — 14 scripts
volume_5/   From Data to Product     —  7 scripts
```

Numbers are sequential within each volume and match the order examples appear
in that volume's chapters. Filenames describe what each script demonstrates.

## Requirements

- **Python 3.11.4** — every script targets this version specifically (see
  Volume One, Chapter 1.5–1.6, for why that matters). Any recent Python 3
  should work fine for these examples, but 3.11.4 is what's guaranteed.
- Install what each volume needs:

```bash
pip install requests beautifulsoup4 SPARQLWrapper --break-system-packages
```

- **Volume Two only:** headless-browser examples additionally need Playwright:
```bash
pip install playwright --break-system-packages
playwright install chromium
```

## Two kinds of scripts in here

Every script's docstring header tells you which kind it is:

- **No note at all** — pure standard library or a small, safe, offline
  example. Runs immediately, no setup needed.
- **"Makes real network requests..."** — talks to a real, live public API
  (the Met, Wikidata, Rijksmuseum, Gutenberg, etc.). Safe to run as-is;
  just needs an internet connection. Be a polite citizen of these free
  public services — don't loop these in a tight batch.
- **"This is a teaching example..."** — demonstrates a *pattern*, with a
  placeholder standing in for something you'd supply yourself (a real
  database connection already open, your own institution-specific import
  function, etc.) when adapting it into a real script.

## A note on self-containment

Where the book shows one technique built up gradually across several code
blocks — the MIA image-resolution pattern, the Rijksmuseum facet crawler, the
Gutenberg EPUB extractor — the corresponding script here includes every piece
it needs to run **on its own**. That occasionally means a short helper function
appears in more than one file (once where it's first taught, again wherever
it's reused) — deliberate, so you can grab any single numbered file and run it
without hunting through the rest of the package first.

## Every script has been verified to actually run

All 49 files pass `python -m py_compile`. Every file that doesn't require a
live network connection, a local database, or a running local service has
been executed directly and confirmed to produce correct output — not just
checked for syntax.

## Questions, corrections, or found a bug?

This is a real, evolving companion package for a real, evolving book series.
If something doesn't run the way this README says it should, that's worth
knowing about — reach out via soretruth.com.
