Example #1
0
def _setupProxy():
    global HTTP_PROXY
    # set in env?
    p = httplib2.ProxyInfo.from_environment()
    if not p:
        # platform-specific fetch
        url = None
        if isWin:
            r = urllib.getproxies_registry()
            if 'https' in r:
                url = r['https']
            elif 'http' in r:
                url = r['http']
        elif isMac:
            r = urllib.getproxies_macosx_sysconf()
            if 'https' in r:
                url = r['https']
            elif 'http' in r:
                url = r['http']
        if url:
            p = httplib2.ProxyInfo.from_url(url, _proxyMethod(url))
    HTTP_PROXY = p
Example #2
0
def _setupProxy():
    global HTTP_PROXY
    # set in env?
    p = httplib2.ProxyInfo.from_environment()
    if not p:
        # platform-specific fetch
        url = None
        if isWin:
            r = urllib.getproxies_registry()
            if 'https' in r:
                url = r['https']
            elif 'http' in r:
                url = r['http']
        elif isMac:
            r = urllib.getproxies_macosx_sysconf()
            if 'https' in r:
                url = r['https']
            elif 'http' in r:
                url = r['http']
        if url:
            p = httplib2.ProxyInfo.from_url(url, _proxyMethod(url))
    HTTP_PROXY = p
Example #3
0
def _setupProxy():
    global HTTP_PROXY
    # set in env?
    p = _proxy_info_from_environment()
    if not p:
        # platform-specific fetch
        url = None
        if isWin:
            r = urllib.getproxies_registry()
            if "https" in r:
                url = r["https"]
            elif "http" in r:
                url = r["http"]
        elif isMac:
            r = urllib.getproxies_macosx_sysconf()
            if "https" in r:
                url = r["https"]
            elif "http" in r:
                url = r["http"]
        if url:
            p = _proxy_info_from_url(url, _proxyMethod(url))
    if p:
        p.proxy_rdns = True
    HTTP_PROXY = p