Permalink
Browse files

get numeric portion of status header into status_code

  • Loading branch information...
1 parent 8132c3a commit ed0f95ad999a6cb7a9ece0f185382b5c4b272804 @jamesturk jamesturk committed Sep 27, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 scrapelib/cache.py
View
@@ -136,7 +136,8 @@ def get(self, orig_key):
resp._content = f.read()
# status & encoding will be in headers, but are faked
- resp.status_code = int(resp.headers.pop('status'))
+ # need to split spaces out of status to get code (e.g. '200 OK')
+ resp.status_code = int(resp.headers.pop('status').split(' ')[0])
resp.encoding = resp.headers.pop('encoding')
resp.url = resp.headers['content-location'] or orig_key
#TODO: resp.request = request

0 comments on commit ed0f95a

Please sign in to comment.