()
return None
Return dict with proxy addresses if they exists.

    Returns
    -------
    proxy_dict
        Dictionary with format {proxy type: proxy address} or None if
        they not set.
Return dict with proxy addresses if they exists.
Return dict with proxy addresses if they exists .
def get_proxies() -> Optional[Dict[str, str]]:
    """
    Return dict with proxy addresses if they exists.

    Returns
    -------
    proxy_dict
        Dictionary with format {proxy type: proxy address} or None if
        they not set.
    """
    def add_protocol(url: Optional[str], prot: str) -> Optional[str]:
        if url and not url.startswith(prot):
            return f"{prot}://{url}"
        return url
    http_proxy = add_protocol(environ.get("http_proxy"), "http")
    https_proxy = add_protocol(environ.get("https_proxy"), "https")
    if http_proxy and https_proxy:  # both proxy addresses defined
        return {"http://": https_proxy, "https://": https_proxy}
    elif any([https_proxy, http_proxy]):  # one of the proxies defined
        return {"all://": http_proxy or https_proxy}
    return None
def get_proxies ( ) -> Optional [ Dict [ str , str ] ] : def add_protocol ( url : Optional [ str ] , prot : str ) -> Optional [ str ] : if url and not url . startswith ( prot ) : return f"{prot}://{url}" return url http_proxy = add_protocol ( environ . get ( "http_proxy" ) , "http" ) https_proxy = add_protocol ( environ . get ( "https_proxy" ) , "https" ) if http_proxy and https_proxy : # both proxy addresses defined return { "http://" : https_proxy , "https://" : https_proxy } elif any ( [ https_proxy , http_proxy ] ) : # one of the proxies defined return { "all://" : http_proxy or https_proxy } return None