returns text content of HTTP GET response.
2933
def GET(self, url):
        """"""
        r = requests.get(url)
        if self.verbose:
            sys.stdout.write("%s %s\n" % (r.status_code, r.encoding))
            sys.stdout.write(str(r.headers) + "\n")
        self.encoding = r.encoding
        return r.text
1254012
def json(self):
        """"""
        if hasattr(self, '_json'):
            return self._json
        try:
            self._json = json.loads(self.text or self.content)
        except ValueError:
            self._json = None
        return self._json
404457
def text(self):
        
        try:
            return self._text
        except AttributeError:
            if IS_PYTHON_3:
                encoding = self._response.headers.get_content_charset("utf-8")
            else:
                encoding = self._response.headers.getparam("charset")
            self._text = self._response.read().decode(encoding or "utf-8")
        return self._text
1144159
def get_text(html_content, display_images=False, deduplicate_captions=False, display_links=False):
    '''
    
    '''
    html_content = html_content.strip()
    if not html_content:
        return ""

    # strip XML declaration, if necessary
    if html_content.startswith('<?xml '):
        html_content = RE_STRIP_XML_DECLARATION.sub('', html_content, count=1)

    html_tree = fromstring(html_content)
    parser = Inscriptis(html_tree, display_images=display_images, deduplicate_captions=deduplicate_captions, display_links=display_links)
    return parser.get_text()
714387
def get_text(self):
        """"""
        return u''.join(u'{0}'.format(b) for b in self.text)
152540
def to_text(self):
        
        if self.text == '':
            return '::%s' % self.uri
        return '::%s [%s]' % (self.text, self.uri)
1012417
def get_as_text(self):
        
        d = {
            'user': self.user or self.name,
            'date': self.post_date,
            'comment': self.text,
            'domain': self.site.domain,
            'url': self.get_absolute_url()
        }
        return _('Posted by %(user)s at %(date)s\n\n%(comment)s\n\nhttp://%(domain)s%(url)s') % d
134371
def _get_request_content(self, message=None):
        '''
        '''
        message = self._cast_message(message=message)
        return message.json()
469107
def _parse_content(self, text):
        '''
        '''
        try:
            return json.loads(text)
        except ValueError:
            raise exc.UnexpectedlyNotJSON(
                "The resource at {.uri} wasn't valid JSON", self)
929777
public static String getResult(HttpResponse response) throws IOException {
		StringBuffer result = new StringBuffer();
		if (response.getEntity() != null && response.getEntity().getContent() != null) {
			BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
			String line = "";
			while ((line = rd.readLine()) != null) {
				result.append(line);
			}
		}
		logger.info(result.toString());
		return result.toString();
	}
594792
def content(self):
        """"""
        return _content.Content(url=self._url + "/content",
                                securityHandler=self._securityHandler,
                                proxy_url=self._proxy_url,
                                proxy_port=self._proxy_port)
1138378
def convert_response_to_text(response):
    """"""
    # Responses are sent as html. Split on the newlines and give us
    # the <p> text back.
    errorlines = response.text.encode("utf-8").split("\n")
    error = []
    pattern = re.compile(r"<p.*>(.*)</p>")
    for line in errorlines:
        content_line = re.search(pattern, line)
        if content_line:
            error.append(content_line.group(1))

    return ". ".join(error)
689417
def http_get(url, fout=None):
    """"""
    print('requests.get({URL}, stream=True)'.format(URL=url))
    rsp = requests.get(url, stream=True)
    if rsp.status_code == 200 and fout is not None:
        with open(fout, 'wb') as prt:
            for chunk in rsp:  # .iter_content(chunk_size=128):
                prt.write(chunk)
            print('  WROTE: {F}\n'.format(F=fout))
    else:
        print(rsp.status_code, rsp.reason, url)
        print(rsp.content)
    return rsp
47559
def get_content (self):
        """"""
        if self.data is None:
            log.debug(LOG_CHECK, "Get content of %r", self.url)
            t = time.time()
            self.data = self.read_content()
            self.size = len(self.data)
            self.dltime = time.time() - t
            if self.size == 0:
                self.add_warning(_("Content size is zero."),
                             tag=WARN_URL_CONTENT_SIZE_ZERO)
            else:
                self.aggregate.add_downloaded_bytes(self.size)
        return self.data
134737
def _read_content(self, response: Response, original_url_info: URLInfo):
        ''''''
        data = response.body.read(4096)
        url_info = original_url_info

        try:
            self._robots_txt_pool.load_robots_txt(url_info, data)
        except ValueError:
            _logger.warning(__(
                _('Failed to parse {url} for robots exclusion rules. '
                  'Ignoring.'), url_info.url))
            self._accept_as_blank(url_info)
        else:
            _logger.debug(__('Got a good robots.txt for {0}.',
                             url_info.url))
465709
def get(url):
    
    text = urlopen(url).read()
    soup = BeautifulSoup(text)
    return Response(text=text, soup=soup)
76364
def content(self, output=None, str_output=None, **kwargs):
        """"""
        if self.response.mimetype != "text/html":
            raise Failure(_("expected request to return HTML, but it returned {}").format(
                self.response.mimetype))

        # TODO: Remove once beautiful soup updates to accomodate python 3.7
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", category=DeprecationWarning)
            content = BeautifulSoup(self.response.data, "html.parser")

        return self._search_page(
            output,
            str_output,
            content,
            lambda regex, content: any(regex.search(str(tag)) for tag in content.find_all(**kwargs)))