Spade
Mini Shell
| Directory:~$ /lib/python2.7/site-packages/requests_toolbelt/utils/ |
| [Home] [System Details] [Kill Me] |
�
ӵ
Yc@s�dZddlZddlZddlmZejddej�jZejddej�jZ ejd�jZ
d�Zd �ZdS(
s7A collection of functions deprecated in
requests.utils.i����N(tutilss!<meta.*?charset=["\']*(.+?)["\'>]tflagss+<meta.*?content=["\']*;?charset=(.+?)["\'>]s$^<\?xml.*?encoding=["\']*(.+?)["\'>]cCsht|�t|�t|�}dtjko:dknrdg|D]}|jd�^qF}n|S(s�Return
encodings from given content string.
.. code-block:: python
import requests
from requests_toolbelt.utils import deprecated
r = requests.get(url)
encodings = deprecated.get_encodings_from_content(r)
:param content: bytestring to extract encodings from
:type content: bytes
:return: encodings detected in the provided content
:rtype: list(str)
iiitutf8(ii(ii(tfind_charsettfind_pragmatfind_xmltsystversion_infotdecode(tcontentt encodingstencoding((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/deprecated.pytget_encodings_from_contents
%cCst�}tj|j�}|r_yt|j|�SWq_tk
r[|j|j��q_Xnt |j�}xa|D]Y}|j�}||kr�qunyt|j|�SWqutk
r�|j|�quXquW|r yt|j|dd�SWq t
k
rq Xn|jS(sMReturn the requested content back in unicode.
This will first attempt to retrieve the encoding from the response
headers. If that fails, it will use
:func:`requests_toolbelt.utils.deprecated.get_encodings_from_content`
to determine encodings from HTML elements.
.. code-block:: python
import requests
from requests_toolbelt.utils import deprecated
r = requests.get(url)
text = deprecated.get_unicode_from_response(r)
:param response: Response object to get unicode content from.
:type response: requests.models.Response
terrorstreplace(tsetRtget_encoding_from_headerstheaderststrR tUnicodeErrortaddtlowerRt TypeErrorttext(tresponsettried_encodingsRR
t _encoding((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/deprecated.pytget_unicode_from_response,s,
(
t__doc__treRtrequestsRtcompiletItfindallRRRRR(((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/deprecated.pyt<module>s