http.client.HTTPConnection and HTTPResponse are missing __repr__
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
http.client.HTTPConnection and HTTPResponse lack repr implementations, producing the default unhelpful object repr:
>>> import http.client
>>> http.client.HTTPConnection('example.com')
<http.client.HTTPConnection object at 0x...>
These should show useful state at a glance:
>>> http.client.HTTPConnection('example.com')
<HTTPConnection example.com:80>
>>> http.client.HTTPSConnection('example.com')
<HTTPSConnection example.com:443>
And for responses:
>>> r = conn.getresponse()
>>> r
<HTTPResponse [200 OK]>
The module already has a repr on IncompleteRead, so there's precedent. This would help when debugging HTTP code in the REPL or debugger.
Linked PRs
- gh-145653
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the http.client module and inspect the existing IncompleteRead repr for precedent. Add useful representations for HTTPConnection, HTTPSConnection, and HTTPResponse matching the examples, then verify the connection and response output in relevant tests; linked PR gh-145653 indicates the work is already underway.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100