Deprecated Requests Utilities¶
Requests has decided to deprecate some utility functions in
requests.utils
. To ease users’ lives, they’ve been moved to
requests_toolbelt.utils.deprecated
.
A collection of functions deprecated in requests.utils.
- requests_toolbelt.utils.deprecated.find_charset(string, pos=0, endpos=9223372036854775807)¶
Return a list of all non-overlapping matches of pattern in string.
- requests_toolbelt.utils.deprecated.find_pragma(string, pos=0, endpos=9223372036854775807)¶
Return a list of all non-overlapping matches of pattern in string.
- requests_toolbelt.utils.deprecated.find_xml(string, pos=0, endpos=9223372036854775807)¶
Return a list of all non-overlapping matches of pattern in string.
- requests_toolbelt.utils.deprecated.get_encodings_from_content(content)¶
Return encodings from given content string.
import requests from requests_toolbelt.utils import deprecated r = requests.get(url) encodings = deprecated.get_encodings_from_content(r)
- requests_toolbelt.utils.deprecated.get_unicode_from_response(response)¶
Return the requested content back in unicode.
This will first attempt to retrieve the encoding from the response headers. If that fails, it will use
requests_toolbelt.utils.deprecated.get_encodings_from_content()
to determine encodings from HTML elements.import requests from requests_toolbelt.utils import deprecated r = requests.get(url) text = deprecated.get_unicode_from_response(r)
- Parameters:
response (requests.models.Response) – Response object to get unicode content from.