Requests utils в python

requests . utils

This module provides utility functions that are used within Requests that are also useful for external consumption.

Function add​_dict​_to​_cookiejar Returns a CookieJar from a key/value dictionary.
Function dict​_from​_cookiejar Returns a key/value dictionary from a CookieJar.
Function get​_encoding​_from​_headers Returns encodings from given HTTP Header Dict.
Function get​_encodings​_from​_content Returns encodings from given content string.
Function get​_unicode​_from​_response Returns the requested content back in unicode.
Constant DEFAULT​_ACCEPT​_ENCODING Undocumented
Constant DEFAULT​_CA​_BUNDLE​_PATH Undocumented
Constant DEFAULT​_PORTS Undocumented
Constant NETRC​_FILES Undocumented
Constant UNRESERVED​_SET Undocumented
Function ​_parse​_content​_type​_header Returns content type and parameters from given header
Function address​_in​_network This function allows you to check if an IP belongs to a network subnet
Function atomic​_open Write a file to the disk in an atomic fashion
Function check​_header​_validity Verifies that header value is a string which doesn’t contain leading whitespace or return characters. This prevents unintended header injection.
Function default​_headers
Function default​_user​_agent Return a string representing the default user agent.
Function dict​_to​_sequence Returns an internal sequence dictionary update.
Function dotted​_netmask Converts mask from /xx format to xxx.xxx.xxx.xxx
Function extract​_zipped​_paths Replace nonexistent paths that look like they refer to a member of a zip archive with the location of an extracted copy of the target, or else just return the provided path unchanged.
Function from​_key​_val​_list Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g.,
Function get​_auth​_from​_url Given a url with authentication components, extract them into a tuple of username,password.
Function get​_environ​_proxies Return a dict of environment proxies.
Function get​_netrc​_auth Returns the Requests tuple auth for a given url from netrc.
Function guess​_filename Tries to guess the filename of the given object.
Function guess​_json​_utf
Function is​_ipv4​_address
Function is​_valid​_cidr Very simple check of the cidr format in no_proxy variable.
Function iter​_slices Iterate over slices of a string.
Function parse​_dict​_header Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict:
Function parse​_header​_links Return a list of parsed link headers proxies.
Function parse​_list​_header Parse lists as described by RFC 2068 Section 2.
Function prepend​_scheme​_if​_needed Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument.
Function proxy​_bypass Return True, if the host should be bypassed.
Function proxy​_bypass​_registry Undocumented
Function requote​_uri Re-quote the given URI.
Function resolve​_proxies This method takes proxy information from a request and configuration input to resolve a mapping of target proxies. This will consider settings such a NO_PROXY to strip proxy configurations.
Function rewind​_body Move file pointer back to its recorded starting position so it can be read again on redirect.
Function select​_proxy Select a proxy for the url, if applicable.
Function set​_environ Set the environment variable ‘env_name’ to ‘value’
Function should​_bypass​_proxies Returns whether we should bypass proxies or not.
Function stream​_decode​_response​_unicode Stream decodes a iterator.
Function super​_len Undocumented
Function to​_key​_val​_list Take an object and test to see if it can be represented as a dictionary. If it can be, return a list of tuples, e.g.,
Function unquote​_header​_value Unquotes a header value. (Reversal of quote_header_value ). This does not use the real unquoting but what browsers are actually using for quoting.
Function unquote​_unreserved Un-escape any percent-escape sequences in a URI that are unreserved characters. This leaves all reserved, illegal and non-ASCII bytes encoded.
Function urldefragauth Given a url remove the fragment and the authentication part.
Constant ​_CLEAN​_HEADER​_REGEX​_BYTE Undocumented
Constant ​_CLEAN​_HEADER​_REGEX​_STR Undocumented
Variable ​_null Undocumented
Variable ​_null2 Undocumented
Variable ​_null3 Undocumented
Читайте также:  Python for comprehension filter

Returns a CookieJar from a key/value dictionary.

Parameters
cj CookieJar to insert cookies into.
cookie​_dict Dict of key/values to insert into CookieJar.
Returns
CookieJar Undocumented

Источник

Оцените статью