'Read proxy info from the environment variables.'

@classmethod
def from_environment(cls, method='http'):

    if (method not in ['http', 'https']):
        return
    env_var = (method + '_proxy')
    url = os.environ.get(env_var, os.environ.get(env_var.upper()))
    if (not url):
        return
    pi = cls.from_url(url, method)
    no_proxy = os.environ.get('no_proxy', os.environ.get('NO_PROXY', ''))
    bypass_hosts = []
    if no_proxy:
        bypass_hosts = no_proxy.split(',')
    if (no_proxy == '*'):
        bypass_hosts = AllHosts
    pi.bypass_hosts = bypass_hosts
    return pi
