PYTHON LESSON

Topic 61/63 · Phase 7: Real-World Tools

REST APIs — Python lesson on EduBard (phase: Real-World Tools)

REST APIs

Main idea

API request sends input and receives structured response.

Tip

Handle status code and timeout always.

Watch out

No error handling for failed requests.

Read this next

You will study REST APIs. It belongs to the Real-World Tools phase.

Remember this:
API request sends input and receives structured response.

Practice step by step. Do not rush. Each run should show you something new.

Tip:
Handle status code and timeout always.

Avoid this:
No error handling for failed requests.

Your challenge:
Call public API and print formatted output.

Go to the challenge lab below. Fix errors until the output looks right. Then press the green button to complete the topic.

Example code

Copy this example if it helps. Change it so it matches REST APIs.

# Topic: REST APIs
def main():
    sample = "edit me"
    # TODO: apply REST APIs concept here
    result = sample
    print("Result:", result)

if __name__ == "__main__":
    main()

Challenge

Call public API and print formatted output.

Before you can finish: your output should include at least 16 characters; at least 1 non-empty line(s); no crash traceback—fix errors until the program runs cleanly.

Use Run. Read the output. Change your code until the task is done.

Starter reference

# Challenge starter for REST APIs
def solve():
    # Write your solution here
    pass

print("Update solve() and run")

Your code

The first Run may load Python in your browser (one-time). Later runs are faster.



    
    

Navigation