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

SourceForge.net noreply at sourceforge.net
Tue Mar 9 11:32:25 EST 2004


Bugs item #912845, was opened at 2004-03-09 18:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Open
Resolution: None
Priority: 5
Submitted By: Ahmed F. (oneofone)
Assigned to: Nobody/Anonymous (nobody)
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



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

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