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

22 Replies, 2237 Views

Quick answer: `.body` isn’t a thing in httpx. Use `.text` for text, `.content` for bytes, or `.json()` for JSON.

Longer answer: The httpx get response body is handled differently than older libs. Check the docs for advanced stuff like streaming responses.

Here’s a cheat sheet:
```python
text = response.text
bytes = response.content
json_data = response.json()
```

Messages In This Thread



Users browsing this thread: 1 Guest(s)