我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用urllib2._parse_proxy()。
def parse_proxy(proxy): return urllib2._parse_proxy(proxy)
def get_proxy(url, orig_type): proxy_type, user, password, hostport = _parse_proxy(url) proxy_url = urlunparse((proxy_type or orig_type, hostport, '', '', '', '')) if user and password: user_pass = '%s:%s' % (unquote(user), unquote(password)) creds = base64.b64encode(force_bytes(user_pass)).strip() else: creds = None return creds, proxy_url