classification
Title: The documentation for urllib.request should mention http.client.HTTPException
Type: behavior Stage: needs patch
Components: Documentation Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, jon orebro, martin.panter
Priority: normal Keywords:

Created on 2015-11-16 08:42 by jon orebro, last changed 2015-11-16 22:17 by martin.panter.

Messages (2)
msg254720 - (view) Author: jon orebro (jon orebro) Date: 2015-11-16 08:42
The documentation for urllib.request should mention that a robust client using urllib.request must be prepared for exceptions of type http.client.HTTPException in addition to urllib.error.URLError.

Example: the server breaks HTTP and returns an empty status line and we get a http.client.BadStatusLine.
msg254762 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-11-16 22:17
Closely related: Issue 22797 proposes documenting some circumstances where ValueError is raised directly. Perhaps you can review and enhance the patch already there.

Also related:

Issue 13736 proposes to wrap http.client exceptions (which I disagree with), and add extra wrapping for socket.error (which I may agree with for consistency), and document existing “exception leaks”.

Issue 6471 discusses awkwardnesses of getting at the underlying exception that URLError wraps.
History
Date User Action Args
2015-11-16 22:17:41martin.pantersetnosy: + martin.panter

messages: + msg254762
stage: needs patch
2015-11-16 08:42:51jon orebrocreate