Open url and read
337770
def reading(self):
        
        try:
            # testing proxy
            proxies = {}
            try:
                proxies["http_proxy"] = os.environ['http_proxy']
            except KeyError:
                pass
            try:
                proxies["https_proxy"] = os.environ['https_proxy']
            except KeyError:
                pass

            if len(proxies) != 0:
                proxy = urllib2.ProxyHandler(proxies)
                opener = urllib2.build_opener(proxy)
                urllib2.install_opener(opener)

            # end testing
            f = urllib2.urlopen(self.link)
            return f.read()
        except (urllib2.URLError, ValueError):
            print("\n{0}Can't read the file '{1}'{2}".format(
                self.meta.color["RED"], self.link.split("/")[-1],
                self.meta.color["ENDC"]))
            return " "
78227
public String readUrl(String url, Watcher watcher) throws Exception {

        return store.read(url, watcher, null);
    }
1335242
public static String read(URL url) throws IOException, NotFoundException {
        BufferedImage image = ImageIO.read(url);
        return read(image);
    }
1184312
def open_browser(self):
        """"""
        webbrowser.open(
            "http://{host}:{port}/".format(host=self.host, port=self.port))
69663
def read(url, **args):
    """"""
    info, data = url.path.split(',')
    info = data_re.search(info).groupdict()
    mediatype = info.setdefault('mediatype', 'text/plain;charset=US-ASCII')
    if ';' in mediatype:
        mimetype, params = mediatype.split(';', 1)
        params = [p.split('=') for p in params.split(';')]
        params = dict((k.strip(), v.strip()) for k, v in params)
    else:
        mimetype, params = mediatype, dict()
    data = base64.b64decode(data) if info['base64'] else urllib.unquote(data)
    return content_types.get(mimetype).parse(data, **params)
877585
public Document readDocument(String url) {
        try {
            URL theURL = new URL(url);
            URLConnection conn = connectWithRedirect(theURL);
            if (conn == null)
                return null;

            ProvFormat format = null;
            String content_type = conn.getContentType();

            logger.debug("Content-type: " + content_type);
            if (content_type != null) {
                // Need to trim optional parameters
                // Content-Type: text/plain; charset=UTF-8
                int end = content_type.indexOf(";");
                if (end < 0) {
                    end = content_type.length();
                }
                String actual_content_type = content_type.substring(0, end)
                        .trim();
                logger.debug("Found Content-type: " + actual_content_type);
                // TODO: might be worth skipping if text/plain as that seems
                // to be the
                // default returned by unconfigured web servers
                format = mimeTypeRevMap.get(actual_content_type);
            }
            logger.debug("Format after Content-type: " + format);

            if (format == null) {
                format = getTypeForFile(theURL.toString());
            }
            logger.debug("Format after extension: " + format);

            InputStream content_stream = conn.getInputStream();

            return readDocument(content_stream, format,url);
        } catch (IOException e) {
            throw new InteropException(e);
        }
    }
419175
def loadFromURL(self, url):
        """"""
        if isfile(url) is True:
            file = open(url, 'r')
        else:
            file = urlopen(url)

        try:     
            result = self.loadDocument(file)
        except Exception, ex:
            file.close()
            raise ParseError(('Failed to load document %s' %url,) + ex.args)
        else:
            file.close()
        return result
483849
def visit(self, url=''):
        
        def _visit(url):
            if len(url) > 0 and url[0] == '/':
                # url's first character is a forward slash; treat as relative path
                path = url
                full_url = self.driver.current_url
                parsed_url = urlparse(full_url)
                base_url = str(parsed_url.scheme) + '://' + str(parsed_url.netloc)
                url = urljoin(base_url, path)

            try:
                return self.driver.get(url)
            except TimeoutException:
                if self.ignore_page_load_timeouts:
                    pass
                else:
                    raise PageTimeoutException.PageTimeoutException(self, url)

        return self.execute_and_handle_webdriver_exceptions(lambda: _visit(url))
939159
public static URL read(String string) {
		try {
			return new URL(string);
		} catch (MalformedURLException e) {
			e.printStackTrace();
			return null;
		}
	}
200064
def open(self, section_index=0):
        """"""
        uri = self._sections[section_index][1]
        if len(uri.split()) == 1:
            self._open_url(uri)
        else:
            if self._verbose:
                print "running command: %s" % uri
            p = popen(uri, shell=True)
            p.wait()
138841
def open(url, options = {})
      uri     = ensure_uri(addressable_normalize(url))
      options = @options.merge(options)

      # Create a Fiber that halts when response headers are received.
      request = Fiber.new do
        net_http_request(uri, options) do |response|
          Fiber.yield response
        end
      end

      response = request.resume

      response_error!(response) unless response.is_a?(Net::HTTPSuccess)

      # Build an IO-like object that will retrieve response body on-demand.
      Down::ChunkedIO.new(
        chunks:     enum_for(:stream_body, response),
        size:       response["Content-Length"] && response["Content-Length"].to_i,
        encoding:   response.type_params["charset"],
        rewindable: options.fetch(:rewindable, true),
        on_close:   -> { request.resume }, # close HTTP connnection
        data: {
          status:   response.code.to_i,
          headers:  response.each_header.inject({}) { |headers, (downcased_name, value)|
                      name = downcased_name.split("-").map(&:capitalize).join("-")
                      headers.merge!(name => value)
                    },
          response: response,
        },
      )
    end
792094
public static void browse(String url) {
		final Desktop dsktop = getDsktop();
		try {
			dsktop.browse(URLUtil.toURI(url));
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
885302
def readlines(self):
        """"""

        t = self.resolved_url.get_resource().get_target()
        with open(t.fspath) as f:
            return f.readlines()
22910
def read(self, params, args, data):
        """"""
        result_count = None
        result_links = None

        if params is None:
            params = []
        if args:
            args = args.copy()
        else:
            args = {}

        ctx = self._create_context(params, args, data)
        row_id = ctx.get_row_id()

        if not row_id:
            self._transform_list_args(args)

            if 'page' in args or 'limit' in args:
                ctx = self._create_context(params, args, data)

                result_count = self._get_collection_count(ctx)

            if 'page' in args:
                result_links = _get_link_pages(
                    page=args['page'],
                    per_page=int(args['limit']),
                    count=result_count,
                    page_url=request.url
                )

            if 'limit' not in args:
                args['limit'] = 'unlimited'

        self._create_related(args)

        try:
            return ResourceResult(
                body=super(JsonServerResource, self).read(params, args, data),
                count=result_count,
                links=result_links
            )
        except NoResultFound:
            return NOT_FOUND
81371
def read_url(url):
    """"""
    logging.debug('reading {url} ...'.format(url=url))
    token = os.environ.get("BOKEH_GITHUB_API_TOKEN")
    headers = {}
    if token:
        headers['Authorization'] = 'token %s' % token
    request = Request(url, headers=headers)
    response = urlopen(request).read()
    return json.loads(response.decode("UTF-8"))
443224
def open_urlview(self, data):
        

        urlview = os.getenv('RTV_URLVIEWER') or 'urlview'
        command = shlex.split(urlview)
        try:
            with self.suspend():
                _logger.debug('Running command: %s', command)
                p = subprocess.Popen(command, stdin=subprocess.PIPE)
                try:
                    p.communicate(input=data.encode('utf-8'))
                except KeyboardInterrupt:
                    p.terminate()

                code = p.poll()
                if code == 1:
                    # Clear the "No URLs found." message from stdout
                    sys.stdout.write("\033[F")
                    sys.stdout.flush()

            if code == 1:
                self.show_notification('No URLs found')

        except OSError as e:
            _logger.exception(e)
            self.show_notification(
                'Failed to open {0}'.format(urlview))
856088
def wget(url):
    
    import urllib.parse
    request = urllib.request.urlopen(url)
    filestring = request.read()
    return filestring