module documentation

Undocumented

Class ​Logger Undocumented
Class ​Net​RCInfo Undocumented
Class ​Timer Undocumented
Class ​URLPattern A utility class currently used for making lookups against proxy keys...
Function format​_form​_param Encode a name/value pair within a multipart form.
Function get​_ca​_bundle​_from​_env Undocumented
Function get​_environment​_proxies Gets proxy information from the environment
Function get​_logger Get a logging.Logger instance, and optionally set up debug logging based on the HTTPX_LOG_LEVEL environment variable.
Function guess​_content​_type Undocumented
Function guess​_json​_utf Undocumented
Function is​_known​_encoding Return True if encoding is a known codec.
Function normalize​_header​_key Coerce str/bytes into a strictly byte-wise HTTP header key.
Function normalize​_header​_value Coerce str/bytes into a strictly byte-wise HTTP header value.
Function obfuscate​_sensitive​_headers Undocumented
Function parse​_header​_links No summary
Function peek​_filelike​_length Given a file-like stream object, return its length in number of bytes without reading it into memory.
Function port​_or​_default Undocumented
Function primitive​_value​_to​_str Coerce a primitive data type into a string value.
Function same​_origin Return 'True' if the given URLs share the same origin.
Function to​_bytes Undocumented
Function to​_bytes​_or​_str Undocumented
Function to​_str Undocumented
Function unquote Undocumented
Constant SENSITIVE​_HEADERS Undocumented
Constant TRACE​_LOG​_LEVEL Undocumented
Constant ​_HTML5​_FORM​_ENCODING​_RE Undocumented
Constant ​_HTML5​_FORM​_ENCODING​_REPLACEMENTS Undocumented
Constant ​_LOGGER​_INITIALIZED Undocumented
Variable ​_null Undocumented
Variable ​_null2 Undocumented
Variable ​_null3 Undocumented
def format_form_param(name, value):
Encode a name/value pair within a multipart form.
Parameters
name:strUndocumented
value:typing.Union[str, bytes]Undocumented
Returns
bytesUndocumented
def get_ca_bundle_from_env():

Undocumented

Returns
typing.Optional[str]Undocumented
def get_environment_proxies():
Gets proxy information from the environment
Returns
typing.Dict[str, typing.Optional[str]]Undocumented
def get_logger(name):
Get a logging.Logger instance, and optionally set up debug logging based on the HTTPX_LOG_LEVEL environment variable.
Parameters
name:strUndocumented
Returns
LoggerUndocumented
def guess_content_type(filename):

Undocumented

Parameters
filename:typing.Optional[str]Undocumented
Returns
typing.Optional[str]Undocumented
def guess_json_utf(data):

Undocumented

Parameters
data:bytesUndocumented
Returns
typing.Optional[str]Undocumented
def is_known_encoding(encoding):
Return True if encoding is a known codec.
Parameters
encoding:strUndocumented
Returns
boolUndocumented
def normalize_header_key(value, lower, encoding=None):
Coerce str/bytes into a strictly byte-wise HTTP header key.
Parameters
value:typing.Union[str, bytes]Undocumented
lower:boolUndocumented
encoding:strUndocumented
Returns
bytesUndocumented
def normalize_header_value(value, encoding=None):
Coerce str/bytes into a strictly byte-wise HTTP header value.
Parameters
value:typing.Union[str, bytes]Undocumented
encoding:strUndocumented
Returns
bytesUndocumented
def obfuscate_sensitive_headers(items):

Undocumented

Parameters
items:typing.Iterable[typing.Tuple[typing.AnyStr, typing.AnyStr]]Undocumented
Returns
typing.Iterator[typing.Tuple[typing.AnyStr, typing.AnyStr]]Undocumented
def parse_header_links(value):

Returns a list of parsed link headers, for more info see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link The generic syntax of those is: Link: < uri-reference >; param1=value1; param2="value2" So for instance: Link; '<http:/.../front.jpeg>; type="image/jpeg",<http://.../back.jpeg>;' would return

[
{"url": "http:/.../front.jpeg", "type": "image/jpeg"}, {"url": "http://.../back.jpeg"},

]

Parameters
value:strHTTP Link entity-header field
Returns
typing.List[typing.Dict[str, str]]list of parsed link headers
def peek_filelike_length(stream):
Given a file-like stream object, return its length in number of bytes without reading it into memory.
Parameters
stream:typing.AnyUndocumented
Returns
typing.Optional[int]Undocumented
def port_or_default(url):

Undocumented

Parameters
url:URLUndocumented
Returns
typing.Optional[int]Undocumented
def primitive_value_to_str(value):

Coerce a primitive data type into a string value.

Note that we prefer JSON-style 'true'/'false' for boolean values here.

Parameters
value:PrimitiveDataUndocumented
Returns
strUndocumented
def same_origin(url, other):
Return 'True' if the given URLs share the same origin.
Parameters
url:URLUndocumented
other:URLUndocumented
Returns
boolUndocumented
def to_bytes(value, encoding='utf-8'):

Undocumented

Parameters
value:typing.Union[str, bytes]Undocumented
encoding:strUndocumented
Returns
bytesUndocumented
def to_bytes_or_str(value, match_type_of):

Undocumented

Parameters
value:strUndocumented
match​_type​_of:typing.AnyStrUndocumented
Returns
typing.AnyStrUndocumented
def to_str(value, encoding='utf-8'):

Undocumented

Parameters
value:typing.Union[str, bytes]Undocumented
encoding:strUndocumented
Returns
strUndocumented
def unquote(value):

Undocumented

Parameters
value:strUndocumented
Returns
strUndocumented
SENSITIVE_HEADERS: set[str] =

Undocumented

Value
set(['authorization', 'proxy-authorization'])
TRACE_LOG_LEVEL: int =

Undocumented

Value
5
_HTML5_FORM_ENCODING_RE =

Undocumented

Value
re.compile("""|""".join([re.escape(c) for c in _HTML5_FORM_ENCODING_REPLACEMENTS
.keys()]))
_HTML5_FORM_ENCODING_REPLACEMENTS: dict[str, str] =

Undocumented

Value
{'"': '%22', '\\': '\\\\'}
_LOGGER_INITIALIZED: bool =

Undocumented

Value
False
_null: bytes =

Undocumented

_null2 =

Undocumented

_null3 =

Undocumented