Featured resource
2026 Tech Forecast
2026 Tech Forecast

1,500+ tech insiders, business leaders, and Pluralsight Authors share their predictions on what’s shifting fastest and how to stay ahead.

Download the forecast
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Core Tech
Labs

Requests and JSON APIs in Python

Build a Python command-line tool that downloads trail conditions as JSON, converts the payload into Python dictionaries and lists, and formats the data into a readable bulletin. Along the way, you will practice installing packages with pip, using the requests library, traversing nested JSON, and wiring the logic into a small CLI with automated tests.

Lab platform
Lab Info
Level
Beginner
Last updated
Jun 30, 2026
Duration
40m

Contact sales

By clicking submit, you agree to our Privacy Policy and Terms of Use, and consent to receive marketing emails from Pluralsight.
Table of Contents
  1. Challenge

    Understand the project and starter structure

    In this lab, you will turn a small Python starter project into a working command-line utility that retrieves JSON data from the web and converts it into a readable trail conditions bulletin. The project is intentionally scoped to core Python skills: calling a third-party package, decoding JSON into native data structures, navigating lists and dictionaries, and composing small functions into a simple end-to-end workflow. info> This lab experience was developed by the Pluralsight team using an internally developed AI tool. All sections were verified by human experts for accuracy prior to publications. However, content may still contain errors or inaccuracies, and we recommend independent verification.

    To report a problem or provide feedback, click here. Feedback may be used to improve accuracy in accordance with our Privacy Policy.

  2. Challenge

    Fetch and decode remote JSON data

    This step builds the application's data-ingestion pipeline. You will create the function that performs the HTTP request, the function that validates and decodes the response body, and the function that extracts the nested trail list from the decoded payload.

  3. Challenge

    Normalize and filter the decoded trail data

    This step transforms raw API records into dependable internal data. Once external JSON has been decoded, the values may still be inconsistent: names can include extra spaces, status text might use mixed casing, numbers can arrive as strings, and optional lists can be missing entirely.

  4. Challenge

    Format and assemble the bulletin output

    This step turns processed data into a user-facing report. The program already knows how to fetch JSON, decode it, normalize trail records, filter visible items, and count alert labels.

  5. Challenge

    Add CLI options and graceful error handling

    The reporting engine is now functional, but a useful tool also needs a clean entry point. This final step adds the command-line layer that lets users customize input and receive helpful feedback when network requests fail. ## Run the Application

    You're ready to test the completed application!

    First, start the sample API server in first Terminal tab:

    python3 sample_server.py
    

    Leave the server running, then in the second Terminal tab and run the application against the local server:

    python3 -m trail_bulletin.cli --url http://localhost:8000/api/trails
    

    If everything is working correctly, the application downloads the trail data and displays a formatted bulletin that includes:

    • A heading with the region, update time, and number of displayed trails
    • One line for each visible trail
    • An alert summary at the end of the report

    To include both open and closed trails, run:

    python3 -m trail_bulletin.cli --all --url http://localhost:8000/api/trails
    

    If the server is unavailable or the request fails, the application should display a message beginning with Unable to download trail data: and exit with a status code of 1.

About the author

Pluralsight’s AI authoring technology is designed to accelerate the creation of hands-on, technical learning experiences. Serving as a first-pass content generator, it produces structured lab drafts aligned to learning objectives defined by Pluralsight’s Curriculum team. Each lab is then enhanced by our Content team, who configure the environments, refine instructions, and conduct rigorous technical and quality reviews. The result is a collaboration between artificial intelligence and human expertise, where AI supports scale and efficiency, and Pluralsight experts ensure accuracy, relevance, and instructional quality, helping learners build practical skills with confidence.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight