Skip to content
← All Python tracks

Config, Logs and Untrusted Input

Python

Check outside data once, where it enters your program, and turn config files, environment variables and request bodies into typed values. Decode bytes on purpose, run commands without a shell, keep user input out of SQL, and log from a library so each application controls what it sees.

This track uses Python. You can make it your practice mode to browse related content across the site.

9 exercises

7 articles

Explore freely. Sign in to keep your progress.

Your learning sequence

  1. 1 Check Outside Data Where It Enters Your Program Read
  2. 2 Not solved yet. Turn Outside Data into a Typed Record Practice · Easy
  3. 3 Not solved yet. Parse a Nested Config with Placeholders and Secrets Practice · Medium
  4. 4 Not solved yet. Read Settings from Environment Variables Practice · Medium
  5. 5 Not solved yet. Merge Settings from a File, the Environment and the Command Line Practice · Medium
  6. 6 Bytes, Text and Line Endings Read
  7. 7 Load Outside Data Without Running Its Code Read
  8. 8 Not solved yet. Run a Command Without a Shell Practice · Easy
  9. 9 Not solved yet. Keep User Input Out of Commands and SQL Practice · Hard
  10. 10 Use Ruff's Security Rules Without the Noise Read
  11. 11 Not solved yet. Log from a Library the Right Way Practice · Easy
  12. 12 Not solved yet. Trace a Log Record Up the Logger Tree Practice · Medium
  13. 13 Not solved yet. Turn Log Fields into JSON-Safe Data Practice · Hard
  14. 14 Diagnose a Slow, Stuck or Crashing Python Service Read
  15. 15 Change a Library's API Without Breaking Its Users Read
  16. 16 Test the Wheel You Ship, Not Your Checkout Read

Check yourself

5 questions · not saved while you're signed out

Use these questions to check your understanding and compare explanations. Your score does not affect track completion.

0 / 5 correct

Nothing in this script sets up logging. What does it print?

Choose one answer to reveal the explanations. Answers are kept only while this page is open.

import logging

logger = logging.getLogger("shop.inventory")

logger.info("reserved 3 apples")
logger.warning("apples are low")
Question 1 of 5