Skip to content

Latest commit

 

History

History

api

README.md

🌐 REST API Request & Client Integration (api) Pedagogical Module

Welcome to the api REST API Integration Module. This module provides a clean 3-tier pedagogical architecture for mastering HTTP REST API interaction, JSON data extraction, object-oriented API client design, range-driven pagination, $O(1)$ memory benchmarking, dir(range) runtime introspection, and historical version evolution notes from Python 2.7 to 3.13.


πŸ“‚ Module Architecture

api/
β”œβ”€β”€ 01_fundamentals/
β”‚   β”œβ”€β”€ basic_api_requests.py        # HTTP GET requests via urllib, status code checking, JSON formatting
β”‚   └── test_fundamentals.py         # Unittest suite mocking urllib HTTP requests
β”œβ”€β”€ 02_advanced_rest_and_endpoints/
β”‚   β”œβ”€β”€ advanced_api_client.py       # Object-oriented PokeApiClient class, endpoint routing, custom exceptions
β”‚   └── test_advanced.py             # Unittest suite mocking multi-endpoint requests & error handling
β”œβ”€β”€ 03_range_evolution_and_performance/
β”‚   β”œβ”€β”€ range_api_pagination.py      # Range sequence pagination, O(1) memory benchmarking, dir(range) matrix
β”‚   └── test_range_evolution.py      # Unittest suite for range offset generator & reflection
β”œβ”€β”€ test_api_master.py              # Master unittest runner executing all 3 sub-tier test suites
└── README.md                        # Module documentation & usage guide

πŸš€ Execution & Usage Guide

1. Basic REST API Requests (01_fundamentals)

Execute basic iTunes API search:

python3 api/01_fundamentals/basic_api_requests.py

2. Advanced REST Client (02_advanced_rest_and_endpoints)

Execute object-oriented PokΓ©API client:

python3 api/02_advanced_rest_and_endpoints/advanced_api_client.py

3. Range Pagination & Evolution (03_range_evolution_and_performance)

Simulate range offset API pagination and memory benchmarks:

python3 api/03_range_evolution_and_performance/range_api_pagination.py

πŸ§ͺ Unit Test Execution

Run the master test runner from the root repository directory:

python3 api/test_api_master.py

Or execute individual test suites:

python3 -m unittest discover -s api/01_fundamentals -p "test_*.py"
python3 -m unittest discover -s api/02_advanced_rest_and_endpoints -p "test_*.py"
python3 -m unittest discover -s api/03_range_evolution_and_performance -p "test_*.py"

πŸ“Š Summary of Pedagogical Features

Sub-Tier Primary Features Covered Code File Unit Test File
01_fundamentals HTTP GET, urllib.request, JSON decoding, query parameter encoding, error handling basic_api_requests.py test_fundamentals.py
02_advanced_rest_and_endpoints OOP client (PokeApiClient), multi-endpoint routing (/pokemon, /ability), PokeApiError advanced_api_client.py test_advanced.py
03_range_evolution_and_performance Range offset pagination, $O(1)$ memory footprint, dir(range) matrix, Py 2.7 to 3.13 history range_api_pagination.py test_range_evolution.py