Encodings


requests.utils.get_encodings_from_content

requests.utils.get_encodings_from_content(content)

Returns encodings from given content string.

Arguments

  • content: bytestring to extract encodings from.

requests.utils.get_encoding_from_headers

requests.utils.get_encoding_from_headers(headers)

Returns encodings from given HTTP Header Dict.

Arguments

  • headers: dictionary to extract encoding from.

requests.utils.get_unicode_from_response

requests.utils.get_unicode_from_response(r)

Returns the requested content back in unicode.

Arguments

  • r: Response object to get unicode content from. Tried:

    1. charset from content-type
    2. fall back and replace all unicode characters