Returns the requested status.

        :param int status_code: the status code to return
        :queryparam str reason: optional reason phrase
183778
def get(self, status_code):
        
        status_code = int(status_code)
        if status_code >= 400:
            kwargs = {'status_code': status_code}
            if self.get_query_argument('reason', None):
                kwargs['reason'] = self.get_query_argument('reason')
            if self.get_query_argument('log_message', None):
                kwargs['log_message'] = self.get_query_argument('log_message')
            self.send_error(**kwargs)
        else:
            self.set_status(status_code)
412822
def get_status(self, statusid):

        

        response = self._req('/user/statuses/{}'.format(statusid))

        s = Status()
        s.from_dict(response)

        return s
1027745
public function withStatus($code, $reasonPhrase = '')
    {
        $status = clone $this;
        $status->setStatus($code, $reasonPhrase);
        
        return $status;
    }
362609
def get_status(self, json_status=None):
        
        if json_status:
            self.json_status = json_status

        if self.json_status not in AjaxResponseStatus.choices:
            raise ValueError(
                "Invalid status selected: '{}'".format(self.json_status))

        return self.json_status
264550
def add_status_code(code):
    
    def class_decorator(cls):
        """内部装饰函数,用于将异常类注册到对应的状态码.

        Parameters:
            cls (Callable): - 要注册的异常类
        Return:
            (Callable): - 注册的异常类

        """
        cls.status_code = code
        _mprpc_exceptions[code] = cls
        return cls

    return class_decorator
401435
def from_status(cls, http_status, code_index=0, message=None, developer_message=None, meta=None):
        # type: (HTTPStatus, int, AnyStr, AnyStr, dict) -> Error
        
        return cls(http_status.value,
                   (http_status.value * 100) + code_index,
                   message or http_status.description,
                   developer_message or http_status.description,
                   meta)
1243685
protected function status($status, $code)
	{
		$data = $this->getStatusData($status);
		return $this->jsonResponse($data, $code);
	}
419158
protected function checkStatusCode($status_code)
	{
		$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
		switch($status_code)
		{
			case 200:	case 201:	break;
			case 204: throw new PrestaShopWebServiceException(sprintf($error_label, $status_code, 'No content'));break;
			case 400: throw new PrestaShopWebServiceException(sprintf($error_label, $status_code, 'Bad Request'));break;
			case 401: throw new PrestaShopWebServiceException(sprintf($error_label, $status_code, 'Unauthorized'));break;
			case 404: throw new PrestaShopWebServiceException(sprintf($error_label, $status_code, 'Not Found'));break;
			case 405: throw new PrestaShopWebServiceException(sprintf($error_label, $status_code, 'Method Not Allowed'));break;
			case 500: throw new PrestaShopWebServiceException(sprintf($error_label, $status_code, 'Internal Server Error'));break;
			default: throw new PrestaShopWebServiceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
		}
	}
1121628
def check_status_code(response, codes=None):
    
    codes = codes or [httplib.OK]
    checker = (
        codes
        if callable(codes)
        else lambda resp: resp.status_code in codes
    )
    if not checker(response):
        raise exceptions.ApiError(response, response.json())
840254
public HttpMessage status(final HttpStatus statusCode) {
        statusCode(statusCode.value());
        reasonPhrase(statusCode.name());
        return this;
    }
333943
def check_status(status):
    
    if status:
        msg = lib.DftiErrorMessage(status)
        msg = ctypes.c_char_p(msg).value
        raise RuntimeError(msg)
700796
def query_status(self):
        ''''''
        try:
            data = self.api_iface._api_get(self.link)
            self._update_details(data)
        except APIError as e:
            print("API error: ")
            for key,value in e.data.iteritems:
                print(str(key) + ": " + str(value))
823489
def _check_status(status):
    """"""
    if status != constants.STATUS_SUCCESS:
        exception = STATUS_TO_EXCEPTION.get(status, CairoError)
        status_name = ffi.string(ffi.cast("cairo_status_t", status))
        message = 'cairo returned %s: %s' % (
            status_name, ffi.string(cairo.cairo_status_to_string(status)))
        raise exception(message, status)
306192
public HttpStatus getStatusCode() {
        final Object statusCode = getHeader(HttpMessageHeaders.HTTP_STATUS_CODE);

        if (statusCode != null) {
            if (statusCode instanceof HttpStatus) {
                return (HttpStatus) statusCode;
            } else if (statusCode instanceof Integer) {
                return HttpStatus.valueOf((Integer) statusCode);
            } else {
                return HttpStatus.valueOf(Integer.valueOf(statusCode.toString()));
            }
        }

        return null;
    }
327755
def status_code(code):
    """"""

    redirect = dict(headers=dict(location=REDIRECT_LOCATION))

    code_map = {
        301: redirect,
        302: redirect,
        303: redirect,
        304: dict(data=''),
        305: redirect,
        307: redirect,
        401: dict(headers={'WWW-Authenticate': 'Basic realm="Fake Realm"'}),
        402: dict(
            data='Fuck you, pay me!',
            headers={
                'x-more-info': 'http://vimeo.com/22053820'
            }
        ),
        406: dict(data=json.dumps({
                'message': 'Client did not request a supported media type.',
                'accept': ACCEPTED_MEDIA_TYPES
            }),
            headers={
                'Content-Type': 'application/json'
            }),
        407: dict(headers={'Proxy-Authenticate': 'Basic realm="Fake Realm"'}),
        418: dict(  # I'm a teapot!
            data=ASCII_ART,
            headers={
                'x-more-info': 'http://tools.ietf.org/html/rfc2324'
            }
        ),

    }

    r = make_response()
    r.status_code = code

    if code in code_map:

        m = code_map[code]

        if 'data' in m:
            r.data = m['data']
        if 'headers' in m:
            r.headers = m['headers']

    return r
1203361
public function statusCode($code = null, $reasonPhrase = null)
    {
        if (func_num_args() < 1 || empty($code)) {
            return $this->response->getStatusCode();
        }
        $this->response = $this->response->withStatus($code, $reasonPhrase);
        return $this;
    }
1090637
def get_status(with_version=False):
    """"""
    client = get_status_api()

    with catch_raise_api_exception():
        data, _, headers = client.status_check_basic_with_http_info()

    ratelimits.maybe_rate_limit(client, headers)

    if with_version:
        return data.detail, data.version

    return data.detail