[ python-Bugs-912845 ] urllib2 checks for http return code 200 only.

SourceForge.net noreply at sourceforge.net
Tue Jun 29 09:19:57 EDT 2004


Bugs item #912845, was opened at 2004-03-09 11:32
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=912845&group_id=5470

Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Ahmed F. (oneofone)
>Assigned to: A.M. Kuchling (akuchling)
Summary: urllib2 checks for http return code 200 only.

Initial Comment:
from urllib2 import *
req = Request("http://someurl/page.html",
headers={'range: bytes=%s':'20-40'})
result = urlopen(req)

will die with something like :
  File "/usr/lib/python2.3/urllib2.py", line 306, in
_call_chain
    result = func(*args)
  File "/usr/lib/python2.3/urllib2.py", line 412, in
http_error_default
    raise HTTPError(req.get_full_url(), code, msg,
hdrs, fp)
urllib2.HTTPError: HTTP Error 206: Partial Content


line 892 in {PATH}/urllib2.py should be changed from :
if code == 200:
to
if code in [200, 206]:

peace



----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2004-06-29 09:19

Message:
Logged In: YES 
user_id=11375

Applied to CVS; thanks!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=912845&group_id=5470



More information about the Python-bugs-list mailing list