In this lab you will build a small command-line client that fetches data from a real public API and processes the results.
You will use JSONPlaceholder โ a free, public REST API for testing and prototyping.
Endpoint: https://jsonplaceholder.typicode.com/todos?userId=1
https://jsonplaceholder.typicode.com/todos?userId=1
This returns a JSON array of todo items for user 1. Each item has this shape:
urllib.request.urlopen
json
"completed": true
Your output must include lines like:
urllib.request
requests
urllib.request.urlopen(url).read()
.decode('utf-8')
json.loads(text)
[t for t in todos if t['completed']]
len()