You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Response repr dumps the entire body; add a concise __repr__ #43
Response in src/pythonnative/net.py (lines 59-104) is a dataclass with a content: bytes field, so the auto-generated repr prints the full response body and all headers. Logging or debugging a fetch call against any real endpoint floods the console:
resp=awaitpn.fetch("https://example.com/big.json")
print(resp) # Response(status=200, url='...', headers={...}, content=b'<many KB of bytes>')
Suggested fix
Add a custom __repr__ that summarizes the body instead of dumping it, for example:
Alternatively, mark the field with field(repr=False) and add the length some other way; a custom __repr__ reads better.
Verification
Add a small unit test to tests/test_net.py asserting the repr contains the status and byte count but not the body. The existing echo-server fixture in that file makes this easy.
I'd like to take this one. Plan: add a custom repr to Response in src/pythonnative/net.py that summarizes the body as a byte count instead of dumping it, and add a test in tests/test_net.py asserting the repr shows status and byte count but not the body.
Activity
glenlouis8 commentedon Sep 1, 2026
I'd like to take this one. Plan: add a custom repr to Response in src/pythonnative/net.py that summarizes the body as a byte count instead of dumping it, and add a test in tests/test_net.py asserting the repr shows status and byte count but not the body.
owenthcarey commentedon Sep 1, 2026
Thank you! Assigned to you.
glenlouis8 commentedon Sep 1, 2026
Opened #49 for this.
feat(net): add concise __repr__ to Response (#49)