Open a URL using the ZAP proxy.
192855
def open_url(zap_helper, url):
    """"""
    console.info('Accessing URL {0}'.format(url))
    zap_helper.open_url(url)
958436
def open(self, mode='r', **kwargs):
        """"""
        _fs, filename = opener.parse(self.uri)
        return _fs.open(filename, mode=mode, **kwargs)
271926
def select_proxy(url, proxies):
    
    proxies = proxies or {}
    urlparts = urlparse(url)
    if urlparts.hostname is None:
        return proxies.get(urlparts.scheme, proxies.get('all'))

    proxy_keys = [
        urlparts.scheme + '://' + urlparts.hostname,
        urlparts.scheme,
        'all://' + urlparts.hostname,
        'all',
    ]
    proxy = None
    for proxy_key in proxy_keys:
        if proxy_key in proxies:
            proxy = proxies[proxy_key]
            break

    return proxy
771181
def execute_from_url(self, url, input_url):
        '''
        

        '''
        inputs = self._request(input_url)
        resp = self.execute(url, inputs)
        return resp
97447
def __open(self, url, headers=None, data=None, baseurl=""):
        """"""
        headers = headers or {}
        if not baseurl:
            baseurl = self.baseurl
        req = Request("%s%s" % (baseurl, url), headers=headers)
        _LOGGER.debug(url)

        try:
            req.data = urlencode(data).encode('utf-8')
        except TypeError:
            pass
        opener = build_opener()

        try:
            resp = opener.open(req)
            charset = resp.info().get('charset', 'utf-8')
            data = json.loads(resp.read().decode(charset))
            opener.close()
            _LOGGER.debug(json.dumps(data))
            return data
        except HTTPError as exception_:
            if exception_.code == 408:
                _LOGGER.debug("%s", exception_)
                return False
            raise TeslaException(exception_.code)
966392
def open(self, target_uri, **kwargs):
        
        target = urlsplit(target_uri, scheme=self.default_opener)

        opener = self.get_opener(target.scheme)
        query = opener.conform_query(target.query)

        target = opener.get_target(
            target.scheme,
            target.path,
            target.fragment,
            target.username,
            target.password,
            target.hostname,
            target.port,
            query,
            **kwargs
        )
        target.opener_path = target_uri

        return target
196931
private HttpURLConnection openConnection(URL url) throws IOException {
        URLConnection urlConnection = url.openConnection();
        if (!(urlConnection instanceof HttpURLConnection)) {
            throw new IllegalStateException("Connection should be an HttpURLConnection");
        }
        return (HttpURLConnection) urlConnection;
    }
566254
def url_read(url, verbose=True):
    
    """
    if url.find('://') == -1:
        url = 'http://' + url
    if verbose:
        print('Reading data from url=%r' % (url,))
    try:
        file_ = _urllib.request.urlopen(url)
        #file_ = _urllib.urlopen(url)
    except IOError:
        raise
    data = file_.read()
    file_.close()
    return data
1332268
def open(self, url, method='get', **kwargs):
        
        response = self.session.request(method, url, **self._build_send_args(**kwargs))
        self._update_state(response)
561194
public static URLConnection open(URL url) throws IOException {
        final ProxyConfiguration p = get();
        
        URLConnection con;
        if(p==null) {
            con = url.openConnection();
        } else {
            Proxy proxy = p.createProxy(url.getHost());
            con = url.openConnection(proxy);
            if(p.getUserName()!=null) {
                // Add an authenticator which provides the credentials for proxy authentication
                Authenticator.setDefault(p.authenticator);
                p.jenkins48775workaround(proxy, url);
            }
        }
        
        if(DEFAULT_CONNECT_TIMEOUT_MILLIS > 0) {
            con.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS);
        }
        
        if (JenkinsJVM.isJenkinsJVM()) { // this code may run on a slave
            decorate(con);
        }

        return con;
    }
1111677
def loadu(self, url, **kwargs):
        
        return self.load(self.open(url, **kwargs), **kwargs)
1005177
public static void openBrowser(String url) {
        logger.debug("Launching browser at [" + url + "]");

        try {
            if (!openBrowserJava6(url)) {
                final String[] command = getOpenBrowserCommand(url);

                if (logger.isTraceEnabled()) {
                    logger.trace("Using command " + Arrays.asList(command));
                }
                Runtime.getRuntime().exec(command);
            }
        } catch (Exception e) {
            throw new IllegalStateException("Failed to open browser", e);
        }
    }
303666
def local_open(url):
    """"""
    scheme, server, path, param, query, frag = urllib.parse.urlparse(url)
    filename = urllib.request.url2pathname(path)
    if os.path.isfile(filename):
        return urllib.request.urlopen(url)
    elif path.endswith('/') and os.path.isdir(filename):
        files = []
        for f in os.listdir(filename):
            filepath = os.path.join(filename, f)
            if f == 'index.html':
                with open(filepath, 'r') as fp:
                    body = fp.read()
                break
            elif os.path.isdir(filepath):
                f += '/'
            files.append('<a href="{name}">{name}</a>'.format(name=f))
        else:
            tmpl = (
                "<html><head><title>{url}</title>"
                "</head><body>{files}</body></html>")
            body = tmpl.format(url=url, files='\n'.join(files))
        status, message = 200, "OK"
    else:
        status, message, body = 404, "Path not found", "Not found"

    headers = {'content-type': 'text/html'}
    body_stream = six.StringIO(body)
    return urllib.error.HTTPError(url, status, message, headers, body_stream)
749981
def proxy(ctx, bind, port):
    
    app = web.Application()
    app.on_startup.append(startup_proxy)
    app.on_cleanup.append(cleanup_proxy)

    app.router.add_route("GET", r'/stream/{path:.*$}', websocket_handler)
    app.router.add_route("GET", r'/wsproxy/{path:.*$}', websocket_handler)
    app.router.add_route('*', r'/{path:.*$}', web_handler)
    if getattr(ctx.args, 'testing', False):
        return app
    web.run_app(app, host=bind, port=port)
570910
def urlopen(url, headers={}, data=None, retries=RETRIES, timeout=TIMEOUT):
    '''
    '''
    headers_merged = default_headers.copy()
    for key in headers.keys():
        headers_merged[key] = headers[key]
    opener = urllib.request.build_opener(ForbiddenHandler)
    opener.addheaders = [(k, v) for k,v in headers_merged.items()]

    for i in range(retries):
        try:
            req = opener.open(url, data=data, timeout=timeout)
            encoding = req.headers.get('Content-encoding')
            req.data = req.read()
            if encoding == 'gzip':
                req.data = gzip.decompress(req.data)
            elif encoding == 'deflate':
                req.data = zlib.decompress(req.data, -zlib.MAX_WBITS)
            return req
        except OSError:
            logger.error(traceback.format_exc())
            
        except:
            logger.error(traceback.format_exc())
            
    return None
217213
def open(self):
        """"""
        if not self.proxy:
            if not config.scgi_url:
                config.engine.load_config()
            if not config.scgi_url:
                self.LOG.error("You need to configure a XMLRPC connection, read"
                    " https://pyrocore.readthedocs.io/en/latest/setup.html")
            self.proxy = xmlrpc.RTorrentProxy(config.scgi_url)
            self.proxy._set_mappings()
        return self.proxy
872898
def open_file(self, url):
        """"""
        if not isinstance(url, str):
            raise URLError('file error: proxy support for file protocol currently not implemented')
        if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/':
            raise ValueError("file:// scheme is supported only on localhost")
        else:
            return self.open_local_file(url)