Use comparisons instead of xrange, until python 3 when it should be more efficent
This commit is contained in:
@@ -59,10 +59,13 @@ 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,
|
||||
|
||||
Reference in New Issue
Block a user