Skip to content
  • Sign In
  • Try Now
View all events
Python

Hands-On Python Programming with HTTPX

Published by Pearson

Beginner to intermediate content levelBeginner to intermediate

Interact with various HTTP services and REST APIs using this modern package

  • Review extensive live code examples (with improvisation), including complex scenarios
  • Interact with globally and freely accessible HTTP servers; no personal lab needed
  • Explore real-world, business-relevant projects

Python is one of the most commonly used programming languages today. REST APIs built atop HTTP are almost ubiquitous in modern business applications. This course combines these two popular topics by teaching you how to use Python HTTPX, a modern and powerful HTTP client library. Whether you are designing a microservice application that utilizes API calls between components or trying to automate your IT infrastructure using HTTP-based APIs, this course is for you.

This course teaches primarily through hands-on demonstrations rather than slides. Watch the live demonstrations, follow along in real-time on your own machine, access the code after class to work through projects on your own time, or any combination of these options. Although this course expects attendees to have at least basic Python experience, the author will review the fundamental topics pertaining to HTTP, REST APIs, and the initial installation of the HTTPX package. Engineers that have experience with the Python “requests” package will have a solid foundation for learning HTTPX.

All web services and REST APIs demonstrated in the course are publicly accessible; attendees do not need to build their own labs.

What you’ll learn and how you can apply it

  • How to interact with a variety of web services
  • The process to identify and leverage a REST API
  • General software design skills, including a complex OOP composition project

And you’ll be able to:

  • Send HTTP requests with options such as query parameters and headers using HTTPX
  • Programmatically handle HTTP redirection based on business requirements
  • Collect large quantities of data using HTTP pagination (iterative) or asyncio (concurrent)
  • Upload/download files over HTTP, debug/examine problematic code, and much more

This live event is for you because...

  • You are a Software Developer, IT Operations Engineer (Network Engineer, Systems Administrator, Database Administrator, etc.), Automation/Test Engineer, or any other role that requires programmatic interaction with HTTP services
  • You need to increase the degree of automation in your work environment by interacting with the HTTP-based APIs of various products and services
  • You need to integrate disparate microservices within an application using HTTP

Prerequisites

  • You understand the basic Python syntax: variables, data types, functions, if statements, for/while loops, object-oriented programming (OOP), and errors/exceptions. Expertise is not required, but attendees should be familiar with these topics.
  • You know what HTTP is, but perhaps don’t yet understand how it works.

Course Set-up

Recommended Preparation

Recommended Follow-up

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Segment 1: HTTP Refresher (10 minutes)

  • Basic request/response structure and format
  • Request methods and their purpose
  • Common return codes and their meanings

Segment 2: Exploring HTTPX Basics (40 minutes)

  • How the package works and when to leverage it
  • Installation and documentation via live demonstration
  • Basic operations using the REPL and simple scripts

Break (10 minutes)

Segment 3: Handling HTTP Redirection (25 minutes)

  • Review a real-life project from the author’s private business
  • Develop a solution to follow or ignore HTTP redirects
  • Use detailed debugging techniques to observe the nuanced differences in behavior

Segment 4: Basic REST API Theory and Interaction with Cisco SD-WAN (25 minutes)

  • Discuss the REST architectural style, including common requirements/constraints
  • Collect and store JSON data from a Cisco DevNet’s SD-WAN sandbox
  • Explore options such as SSL validation, HTTP body formats, and persistent sessions

Break (10 minutes)

Segment 5: Intermediate REST API Interaction with pokeapi (25 minutes)

  • Review two HTTPX-based REST API data collection scripts
  • Dig successively deeper into hierarchical data structures when searching for data
  • Use HTTP pagination to collect and retain large or unknown quantities of data

Segment 6: Advanced REST API Interaction with pokeapi using asyncio (25 minutes)

  • Explore a more efficient alternative to the iterative HTTP pagination approach
  • Explain and demonstrate HTTPX + asyncio integration to send concurrent REST API requests
  • Gracefully handle API throttling errors signaled via HTTP status codes

Break (10 minutes)

Segment 7: REST API Interaction Involving File Transfers and Asynchronous API Processing (55 minutes)

  • Complete review of a business-relevant project to post-produce audio files
  • Detailed and nuance explanation of OOP-based composition design
  • Includes file uploads/downloads, error checking, custom methods, and status checking

Q&A (5 minutes)

Your Instructor

  • Nicholas Russo

    Nicholas Russo holds a Bachelor’s of Science in Computer Science from the Rochester Institute of Technology (RIT). His primary programming experience is in C# and Java, but has been programming almost exclusively in Ansible and Python over the past several years. Nick’s day job is an automation-focused network engineer, but he loves teaching others about technology. Nick lives in Maryland, USA with his wife, Carla, and daughters, Olivia and Josephine.

    linkedinXlinksearch