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
http.client.HTTPConnection and HTTPResponse lack repr implementations, producing the default unhelpful object repr:
These should show useful state at a glance:
And for responses:
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
http.client.{HTTPConnection,HTTPResponse}.__repr__#145653