How do I extract the response body from an httpx GET request? or What's the best way to access the ht

22 Replies, 2242 Views

Haha, welcome to httpx! The httpx get response body is *not* `.body`. Use:
- `.text` for text (duh).
- `.content` for bytes (like images).
- `.json()` for JSON (lifesaver).

And always, *always* check `response.status_code` first. Nothing worse than debugging why your `.text` is empty when the request failed silently.

Messages In This Thread



Users browsing this thread: 1 Guest(s)