Automation

Learning Goals

  1. Use Python code to get data from web sites.
  2. Create a Python module that can be either imported or used to run code from the command line.
  3. Create a Python script that accepts arguments from the command line to modify its actions.
  4. Use bash scripts to automate execution of shell commands and Python scripts
  5. Use at and cron to defer or schedule execution of shell scripts.

Automation Notebooks

Create and switch to a new automation branch in your repo. Create an automation directory and copy the climate_data.py file into it. Start ipython notebook in your automation directory.

The notebooks we're going to work through are:

  • automation-0-requests: using the requests library to get data from web sites
  • automation-1-args: creating a Python module that can be both used for imports and run from the command line, and handling command line arguments in Python
  • automation-2-shell: writing shell scripts to execute shell commands and/or Python scripts and using at and cron to defer and repeat execution of those scripts

The notebooks for this lesson are available in this automation.zip archive.

References

Back to Topics