import requests

# APIs return live data — here we ask a free “advice” service for a quote
url = "https://api.adviceslip.com/advice"
response = requests.get(url)

# Check status — 200 means OK
if response.status_code == 200:
    data = response.json()          # parse JSON into a Python dict
    print("Hermione says:", data["slip"]["advice"])
else:
    print("Could not reach the owl post:", response.status_code)
