Send an HTTP GET to the server and return the HTTP status code.
342282
def send_request(self, ssl_client: SslClient) -> str:
        
        try:
            ssl_client.write(HttpRequestGenerator.get_request(self._hostname))

            # Parse the response and print the Location header
            http_response = HttpResponseParser.parse_from_ssl_connection(ssl_client)
            if http_response.version == 9:
                # HTTP 0.9 => Probably not an HTTP response
                result = self.ERR_NOT_HTTP
            else:
                redirect = ''
                if 300 <= http_response.status < 400:
                    redirect_location = http_response.getheader('Location')
                    if redirect_location:
                        # Add redirection URL to the result
                        redirect = f' - {redirect_location}'

                result = self.GET_RESULT_FORMAT.format(http_response.status, http_response.reason, redirect)
        except socket.timeout:
            result = self.ERR_HTTP_TIMEOUT
        except IOError:
            result = self.ERR_GENERIC

        return result
930103
def getresponse(self):
        
        resp = self.http.getresponse()
        self.log.info("resp is %s", str(resp))
        if resp.status < 400:
            return resp
        else:
            errtext = resp.read()
            content_type = resp.getheader('Content-Type', 'text/plain')
            raise HttpError(code=resp.status, content_type=content_type, content=errtext)
822615
def _handle_api(self, handler, handler_args, handler_kwargs):
        
        try:
            status_code, return_value = handler(*handler_args, **handler_kwargs)
        except APIError as error:
            return error.send()

        web.ctx.status = _convert_http_status(status_code)
        return _api_convert_output(return_value)
205456
def http_get(url, filename=None):
    """"""
    try:
        ret = requests.get(url)
    except requests.exceptions.SSLError as error:
        _LOGGER.error(error)
        return False

    if ret.status_code != 200:
        return False

    if filename is None:
        return ret.content

    with open(filename, 'wb') as data:
        data.write(ret.content)
    return True
841711
def send_http_error(self, http_code, cim_error=None,
                        cim_error_details=None, headers=None):
        
        self.send_response(http_code, http_client.responses.get(http_code, ''))
        self.send_header("CIMExport", "MethodResponse")
        if cim_error is not None:
            self.send_header("CIMError", cim_error)
        if cim_error_details is not None:
            self.send_header("CIMErrorDetails", cim_error_details)
        if headers is not None:
            for header, value in headers:
                self.send_header(header, value)
        self.end_headers()
        self.log('%s: HTTP status %s; CIMError: %s, CIMErrorDetails: %s',
                 (self._get_log_prefix(), http_code, cim_error,
                  cim_error_details),
                 logging.WARNING)
1045453
def respond(self, code):
        

        # TODO: respect encodings etc. in the request
        resp = HttpResponse(code, self.connection)
        resp.request = self
        if hasattr(self, 'version'):
            resp.version = self.version
        return resp
26799
def get_request(self, url):
        

        resp = self.session.get(url, timeout=self.timeout,
                                proxies=self.proxies)
        result = resp.json()
        if result['code'] != 200:
            LOG.error('Return %s when try to get %s', result, url)
            raise GetRequestIllegal(result)
        else:
            return result
192259
def get(self, *args, **kwargs):
        
        self.set_status(self._status_response_code())
        self.write(self._status_response())
644080
def process_request(self, req):
        '''  '''
        # Check status code of request
        req.raise_for_status() # if codes not in 200s; error raise
        # Proper status code, but check if server returned a warning
        try:
            output = req.json()
        except:
            exit(req.text) # server returned html error
        # Try to find an error msg in the server response
        try:
            error = output['data'].get('errormsg')
        except:
            error = output.get('errormsg') # server has 2 variations of errormsg
        finally:
            if error:
                exit(error)
            return output
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
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
58839
function sendStats() {
      var key = req[options.requestKey];
      key = key ? key + '.' : '';

      // Status Code
      var statusCode = res.statusCode || 'unknown_status';
      client.increment(key + 'status_code.' + statusCode);

      // Response Time
      var duration = new Date().getTime() - startTime;
      client.timing(key + 'response_time', duration);

      cleanup();
    }
1062893
function (code) {
        return function (data) {
            return data ? res.status(code).send(data):
                          res.status(code);
        };
    }
1340983
function getStatus(url, callback) {
  var client = new HttpClient(url);
  var executor = new Executor(client);
  var command = new Command(CommandName.GET_SERVER_STATUS);
  executor.execute(command, function(err, responseObj) {
    if (err) return callback(err);
    try {
      checkResponse(responseObj);
    } catch (ex) {
      return callback(ex);
    }
    callback(null, responseObj['value']);
  });
}
1018111
def get_send_result(self):
        """"""
        send_result = self.json_response.get("send_result", None)
        self.logger.info("%s\t%s" % (self.request_method, self.request_url))
        return send_result
974756
def get(self, url, data=None):
        
        response = self.http.get(url,
                                 headers=self.headers,
                                 params=data,
                                 **self.requests_params)
        return self.process(response)
69011
def get(self, uri, disable_proxy=False, stream=False):
        """"""
        response = requests.get(
            uri,
            headers=self.headers,
            allow_redirects=True,
            cookies={},
            stream=stream,
            proxies=self.proxy if not disable_proxy else False
        )

        if response.status_code in _PERMITTED_STATUS_CODES:
            self.response_headers = response.headers
            return response.content if not stream else response.iter_content()
        else:
            raise requests.exceptions.HTTPError(
                "HTTP response did not have a permitted status code."
            )