Skip to content

Commit

Permalink
Merge branch 'issue5', fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
hubugui committed Jan 5, 2014
2 parents e2dde17 + 3793030 commit be2663b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 1/task/FetchTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_charset_from_content(self, content):
return charset.lower()
return None

def get_header_value(response, key):
def get_header_value(self, response, key):
try:
return response.headers[key]
except:
Expand All @@ -61,13 +61,13 @@ def POST(self):
print response.headers

# http header->encoding
encoding = get_header_value(response, 'Content-Encoding')
encoding = self.get_header_value(response, 'Content-Encoding')
if encoding == 'gzip':
content = gzip.GzipFile(fileobj = cStringIO.StringIO(content)).read()

# http header->type
charset = None
ctype = get_header_value(response, 'Content-Type')
ctype = self.get_header_value(response, 'Content-Type')
if ctype:
# for example: text/html; charset=utf-8
ctype = ctype.lower().replace(' ', '').strip()
Expand Down

0 comments on commit be2663b

Please sign in to comment.