What is Python's requests library?
Answer
requests is the most popular Python HTTP library for making web requests. Install: pip install requests. GET: response = requests.get("https://api.example.com/users"). POST with JSON: requests.post(url, json={"name": "Alice"}). Access response: response.status_code, response.json(), response.text, response.content (bytes), response.headers. Parameters: requests.get(url, params={"page": 1}). Headers: requests.get(url, headers={"Authorization": f"Bearer {token}"}). Timeout: requests.get(url, timeout=10) (always set timeouts). Authentication: requests.get(url, auth=("user", "pass")). Sessions (reuse connections, persist cookies): with requests.Session() as session: session.get(url). For async HTTP, use aiohttp or httpx (which supports both sync and async).
Previous
What is pytest in Python?
Next
What is Python's virtual environment and dependency management?