🐍 Pythons learning
PYTHON • DATA SCIENCE • AI

Master Python, Data Science & Machine Learning

#Python #Pandas #NumPy #MachineLearning #Projects

Monday, November 23, 2026

Requests Library in Python: Working with APIs and HTTP

Requests is an elegant and simple HTTP library for Python, built for human beings. It allows you to send HTTP/1.1 requests easily, with features like automatic content decoding, session management, and JSON support.


Installation:

pip install requests


Key Features:

- Simple and intuitive API for GET, POST, PUT, DELETE requests

- Automatic JSON parsing and encoding

- Custom headers, query parameters, and form data support

- Connection pooling, SSL verification, and timeout settings


Code Example:

import requests


# Send GET request to a public API

response = requests.get('https://api.github.com')

print("Status Code:", response.status_code)

print("Content-Type:", response.headers['content-type'])

data = response.json()

print("Keys in response:", list(data.keys())[:5])

No comments:

JSON Module in Python: Parsing and Writing JSON Data

The json module in Python allows you to encode and decode JSON (JavaScript Object Notation) data. It provides built-in methods for convertin...