From 6b3434ae04f32a20e20498ec5a594d527e1c24e3 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Thu, 15 Mar 2012 18:11:16 -0700 Subject: Explain the use of charset parameter with Content-Type header. Issue11082 --- Lib/urllib/request.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Lib/urllib/request.py') diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 94b713e8855..fe2cfcdbbef 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1062,8 +1062,9 @@ class AbstractHTTPHandler(BaseHandler): if request.data is not None: # POST data = request.data if isinstance(data, str): - raise TypeError("POST data should be bytes" - " or an iterable of bytes. It cannot be str.") + msg = "POST data should be bytes or an iterable of bytes."\ + "It cannot be str" + raise TypeError(msg) if not request.has_header('Content-type'): request.add_unredirected_header( 'Content-type', -- cgit v1.2.3