🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 25: Chat App Interface

Python Challenge

Builds on these lessons

Step 1 of 3
Project

Sending a Message with requests

POST a chat message with requests.post(url, json={"text": message}). requests is the most widely used HTTP client in Python — its API (get, post, plus a json= shortcut that handles serialization and headers) is what most other HTTP libraries model themselves after.

🎯 Your Task

Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!

import requests

def send_message(text):
    response = requests.post("https://chat.example.com/api/messages", json={"text": text})
    return response.status_code

status = send_message("Hey, are we still on for 3pm?")
print(status)