A step-by-step project where I explore the Open Brewery DB API, filter breweries by type and location, and eventually build a script that finds 5 microbreweries in 5 different US states.
The script fetches random breweries from the API, filters them by type and country, and saves the results into JSON files.
Invalid breweries (e.g., wrong type, outside the US, duplicate state) are logged with reasons.
- Calls the Open Brewery DB random endpoint.
- Collects 5 microbreweries from 5 unique US states.
- Logs rejected breweries with:
- Reason (
wrong_type,not_us,missing_state,duplicate_state) - Timestamp of fetch
- Reason (
- Handles:
- Network errors
- API timeouts
- Rate limiting
- Server errors
- Saves results to:
data/found_breweries.json→ valid breweriesdata/error_log.json→ rejected breweries