How can I get the incoming response's encoding using httplib/http.client?
I can see as part of Content-Type using getheaders(), but I would guess it is bad practise to parse that since it might be in a few different formats, and you are supposed to use a particular method in httplib/http.client instead:
>>> r = h.getresponse()
>>> r.getheaders()
[('transfer-encoding', 'chunked'), ('expires', 'Tue, 11 Oct 1988 22:00:00 GMT'), ('vary', 'Accept-Encoding'), ('server', 'nginx/1.2.6'), ('connection', 'keep-alive'), ('pragma', 'no-cache'), ('cache-control', 'no-cache, must-revalidate'), ('date', 'Thu, 18 Apr 2013 00:46:18 GMT'), ('content-type', 'text/html; charset=utf-8')]
What is the best way to get the incoming encoding?