Use comparisons instead of xrange, until python 3 when it should be more efficent

This commit is contained in:
harlowja
2012-06-20 00:41:39 -07:00
parent 9f373034e4
commit 0bb5df8912

View File

@@ -59,11 +59,14 @@ class UrlResponse(object):
return str(self.contents)
def ok(self, redirects_ok=False):
upper = 300
if redirects_ok:
return self.code in xrange(200, 400)
upper = 400
if self.code >= 200 and self.code < upper:
return True
else:
return self.code in xrange(200, 300)
return False
def readurl(url, data=None, timeout=None,
retries=0, sec_between=1, headers=None):