Python for Network Engineers · Python 14
From script to tool: argparse, logging, error handling and cron
A script that only works when you run it by hand, from the right folder, on a day when every router answers, is not a tool. Add command-line options with argparse, dated output with datetime, a log file with levels, error handling that keeps going when one device is down, a useful exit code, and then let cron run it every night.
36 min read9 chapters2 labs15 quiz7 scenarios15 interview Q&A
This module is part of the paid plans
The free Starter plan opens the first module of every path. Upgrade to unlock this module's lesson, labs, quiz and scenarios.
Your free Starter plan includes
- ✓First module of every path — lessons and quizzes
- ✓3 hands-on labs in total
- ✓Practice questions (up to 10 per set)
- ✓Build your own lab — 3 sessions a month, up to 4 devices
Inside this module
- Lab 1 · Make the backup tool survive a dead router
- Lab 2 · Run the backup tool from cron