Advanced Python

Duration

35 hours or 5 classroom days

Course Overview

The objective of this class is to push students beyond print( 'hello world' ). Students work to develop Python scripts that handle exceptions, interface with the operating system, communicating with RESTful (and non-RESTful) APIs, understand and write complex scripts with multiple threads, and learn to work with libraries, like NAPALM, to automate L2 and L3 network devices across a wide breadth of vendors (Juniper, Cisco, Arista, to name a few). Other skills students will learn include; parsing data structures (such as XML, YAML, and JSON), writing and creating highly efficient regular expression, best practices and code review, and interacting with IMAP (email).

Download Detailed Outlline

  1. Python Review - Useful Modules
    • Built-in Module Review
    • Using import - Review
    • Operator
    • Decimal
    • Using pip - Review
    • Interfacing with Excel
    • Prettyprinting
    • Shutil
    • Python Linting
  1. Writing Functions and Modules
    • Functions - Review
    • Variable Scope - Review
    • Converting boiler plate code to functional code
    • Writing Functions (reusable code)
    • Publishing a module
    • Documenting modules
    • Using from x import y - Review
    • Module search path (PYTHONPATH)
  1. Exceptions
    • About Exceptions
    • Python's Default Exception Handler
    • Common Errors
    • Using Try/Except/Finally Exceptions
    • Generating User Defined Exceptions
    • Raise
    • More on Exceptions
    • Exception Examples
    • Using Asserts
    • Exception Classes
  1. Python Generators
    • About generators
    • Iterators - lazy evaluation
    • Generator Syntax
    • Communicating with Generators with send()
  1. OS Interfacing
    • Operating System interfacing with OS module
    • OS module - listdir(), getcwd(), mkdir()
    • Common sys Module Attributes & Methods
    • Working With the os Module & Files/Directories
    • Walking File Trees with os.walk()
    • File, Path and Directory Examples
    • Working with os.path
    • os & os.path Module Examples
    • Environmental Variables
    • Running Shell Commands
    • Compressing and archiving (gzip, tar, zip)
  1. Dates and Times
    • Python and Cron
    • Import time and time.time()
    • Suspending threads with sleep()
    • Dealing with time
    • Time formatting
    • Time tuples
    • Creating Calendars
  1. Web and RESTful APIs
    • REST
    • REST APIS and HTTP CRUD
    • REST and OpenStack
    • Wireshark capturing
    • cURL
    • Etcd keystore
    • Creating a Python client to interact with API endpoints
    • API dev keys
    • SSH and Python
  1. Python Regular Expression
    • Metacharcter review
    • Re modules
    • search() and match()
    • findall()
    • Compiling regex search patterns
    • Creating highly efficient searches
  1. Python Protocol Clients
    • Scripting the browser
    • Scripting with HTTP
    • Creating an HTTP Client & Server
    • Building an FTP Client & Server
    • Python and FTP limitations

 

  1. Generating and Sending Emails
    • Overview of email modules
    • Creating simple emails
    • Interfacing with your email account
  1. Globbing
    • Glob patterns
    • Returning directory lists
    • Printing directory names
  1. XML Formatting and Beyond
    • JSON RFC 7159
    • JSON Formatting
    • YAML intro
    • YAML lists
    • YAML dictionaries
    • YAML line spanning
    • Reading YAML is easy
    • XML
    • CSV
    • Import json
    • Import yaml
    • Decoding json and yaml to use
    • Using python to decode data structures like YAML, XML, CSV, and JSON
  1. Code Review
    • Conventions
    • Underscore
    • Double underscore
    • Monkey Patching
  1. Processes and Threads
    • Threading
    • Context change
    • Deadlock errors
    • Thread starvation
    • Racing conditions
    • Racing specifics
    • Working with Locks
    • Using Reentrant Locks
    • Condition Objects
    • Using the Queue Object
    • Using Semaphores
    • Using with for Locks, RLocks, Condition & Sempahores
    • Processing Exit Codes
  1. Introducing Network Automation (with NAPALM)
    • Automating network transactions
    • Python abstraction
    • NAPALM installation
    • Writing napalm scripts
    • NAPALM drivers
    • Connect / Disconnect
    • Rollback Changes
    • Merge
    • Commit
  1. Automating Cisco Configurations (Optional)
    • Introduction to Python Cisco Conf Parse
    • Searching pypi for useful ‘free’ code
    • Editing network configurations
    • Manipulating Network configs with python

Labs

  • Lab 01 - Space APIs the Final Frontier
  • Lab 02 - Try and Except 01
  • Lab 03 - Try and Except 02
  • Lab 04 - More APIs ...Vast
  • Lab 05 - Making Excel Sheets
  • Lab 06 - Practicing Function 02
  • Lab 07 - Running Scripts with Crontab
  • Lab 08 - import time
  • Lab 09 - import datetime
  • Lab 10 - import cal
  • Lab 11 - Use RegEx ...IP Address
  • Lab 12 - Use RegEx to Search Text
  • Lab 13 - Cisco Conf Parse
  • Lab 14 - HTTP(S) RESTful Interfaces
  • Lab 15 - Construct a ...HTTP Client
  • Lab 16 - Interaction with APIs - NASA 01
  • Lab 17 - Interaction with APIs - NASA 02
  • Lab 18 - Paramiko - SFTP with UN and PW
  • Lab 19 - Paramiko - SSH with RSA
  • Lab 20 - Paramiko - Environment Setup
  • Lab 21 - Reading Excel Sheets
  • Lab 22 - Argument Parsing
  • Lab 23 - re.findall(re.IGNORECASE)
  • Lab 24 - re.sub()
  • Lab 25 - re.compile()
  • Lab 26 - Testing if a Match Exists
  • Lab 27 - import datetime 02
  • Lab 28 - Getting sorted()
  • Lab 29 - Custom sorted() with key
  • Lab 30 - Custom sorted ...myFunct
  • Lab 31 - Sorting lists of dictionaries
  • Lab 32 - Sort Stability and Complex Sorts
  • Lab 33 - sort() vs sorted()
  • Lab 35 - os.walk() the Directory Tree
  • Lab 36 - csv.reader()
  • Lab 37 - csv.DictReader()
  • Lab 38 - csv.DictWriter()
  • Lab 39 - Archive with zipfile
  • Lab 40 - getpass - Secure Password Retrieval

 

python2_tutorial

Enroll

Self-paced: $ 99.95 USD

  • Digital course materials COMING SOON!
  • Includes 1 year access to videos
  • 60 day access to hands-on labs

Live Instructor via the web: $ 2195 USD

  • Virtual web-based presentation
  • A teacher to guide you
  • Plus all the self-paced items

Bring us Onsite:

  • Contact us for onsite quotes

Next Public Course Offerings:

  • Please contact us for the next scheduled event
  • Testimonials

    Different plans for everyone

    Choose the pricing that fits your business needs

    Live Instructor via the Web
    $ 2195
  • Virtual web-based presentation
  • A teacher to guide you
  • Plus all the self-paced items
  • Buy Instructor Led

    Onsite
    Contact Us
  • Instructor led class
  • Hands-on Lab access
  • Digital Course Materials
  • 1 year access to labs
  • Contact Us