![]() Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : fdshops ( 1003) PHP Version : 8.2.21 Disable Function : NONE Directory : /lib/python2.7/site-packages/requests_toolbelt/utils/ |
� ӵ Yc @ s� d Z d d l Z d d l Z d d l m Z e j d d e j �j Z e j d d e j �j Z e j d � j Z d � Z d � Z d S( s7 A collection of functions deprecated in requests.utils.i����N( t utilss! <meta.*?charset=["\']*(.+?)["\'>]t flagss+ <meta.*?content=["\']*;?charset=(.+?)["\'>]s$ ^<\?xml.*?encoding=["\']*(.+?)["\'>]c C sh t | � t | � t | � } d t j k o: d k n rd g | D] } | j d � ^ 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) i i i t utf8( i i ( i i ( t find_charsett find_pragmat find_xmlt syst version_infot decode( t contentt encodingst encoding( ( sF /usr/lib/python2.7/site-packages/requests_toolbelt/utils/deprecated.pyt get_encodings_from_content s %c C s t � } t j | j � } | r_ y t | j | � SWq_ t k r[ | j | j � � q_ Xn t | j � } xa | D]Y } | j � } | | k r� qu n y t | j | � SWqu t k r� | j | � qu Xqu W| r y t | j | d d �SWq t k rq Xn | j S( sM 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 :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 t errorst replace( t setR t get_encoding_from_headerst headerst strR t UnicodeErrort addt lowerR t TypeErrort text( t responset tried_encodingsR R t _encoding( ( sF /usr/lib/python2.7/site-packages/requests_toolbelt/utils/deprecated.pyt get_unicode_from_response, s, ( t __doc__t reR t requestsR t compilet It findallR R R R R ( ( ( sF /usr/lib/python2.7/site-packages/requests_toolbelt/utils/deprecated.pyt <module> s