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 |
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 |