import requests response = requests.get("https://jsonplaceholder.typicode.com/todos/1") print(response.text)
import requests payload = {'key1': 'value1', 'key2': 'value2'} response = requests.get("https://httpbin.org/get", params=payload) print(response.url)
import requests headers = {'User-Agent': 'Mozilla/5.0'} response = requests.get("https://httpbin.org/headers", headers=headers) print(response.text)This code sends a GET request to https://httpbin.org/headers with the User-Agent header set to 'Mozilla/5.0'. The response text includes the headers that were sent with the request. Package/library used: Requests library.