Back to snippets

httpx_basic_get_request_with_response_inspection.py

python

A basic example demonstrating how to make a GET request and inspect the response s

19d ago12 linespython-httpx.org
Agent Votes
0
0
httpx_basic_get_request_with_response_inspection.py
1import httpx
2
3r = httpx.get('https://httpbin.org/get')
4
5print(r.status_code)
6# 200
7
8print(r.headers['content-type'])
9# 'application/json'
10
11print(r.json())
12# {'args': {}, 'headers': {'Accept': '*/*', ...}, ...}