Custom _load method to accommodate for issue in 11.5.4,

        where an existing object would return 404 HTTP response.
779907
def _load_11_5_4(self, **kwargs):
        
        if 'uri' in self._meta_data:
            error = "There was an attempt to assign a new uri to this " \
                    "resource, the _meta_data['uri'] is %s and it should" \
                    " not be changed." % (self._meta_data['uri'])
            raise URICreationCollision(error)
        requests_params = self._handle_requests_params(kwargs)
        self._check_load_parameters(**kwargs)
        kwargs['uri_as_parts'] = True
        refresh_session = self._meta_data['bigip']._meta_data[
            'icr_session']
        base_uri = self._meta_data['container']._meta_data['uri']
        kwargs.update(requests_params)
        for key1, key2 in self._meta_data['reduction_forcing_pairs']:
            kwargs = self._reduce_boolean_pair(kwargs, key1, key2)
        kwargs = self._check_for_python_keywords(kwargs)
        try:
            response = refresh_session.get(base_uri, **kwargs)
        except HTTPError as err:
            if err.response.status_code != 404:
                raise
            if err.response.status_code == 404:
                return self._return_object(self._meta_data['container'],
                                           kwargs['name'])
        # Make new instance of self
        return self._produce_instance(response)
166853
def create(cls, custom_headers=None):
        

        if custom_headers is None:
            custom_headers = {}

        request_map = {

        }
        request_map_string = converter.class_to_json(request_map)
        request_map_string = cls._remove_field_for_request(request_map_string)

        api_client = client.ApiClient(cls._get_api_context())
        request_bytes = request_map_string.encode()
        endpoint_url = cls._ENDPOINT_URL_CREATE
        response_raw = api_client.post(endpoint_url, request_bytes,
                                       custom_headers)

        return BunqResponseSandboxUser.cast_from_bunq_response(
            cls._from_json(response_raw, cls._OBJECT_TYPE_POST)
        )
680746
function loadRemoteRawData(url) {
  if (!url) {
    // TODO: we should return reject with an appropriate error
    return Promise.resolve(null)
  }

  return new Promise((resolve, reject) => {
    request(url, (error, result) => {
      if (error) {
        reject(error);
      }
      const responseError = detectResponseError(result);
      if (responseError) {
        reject(responseError);
        return;
      }
      resolve(result.response)
    })
  });
}
345408
def _construct_error_handling(self):
        
        # Both path and method not present
        self._app.register_error_handler(404, ServiceErrorResponses.route_not_found)
        # Path is present, but method not allowed
        self._app.register_error_handler(405, ServiceErrorResponses.route_not_found)
        # Something went wrong
        self._app.register_error_handler(500, ServiceErrorResponses.lambda_failure_response)
713074
def documentation_404(self, base_url=None):
        """"""
        base_url = self.base_url if base_url is None else base_url

        def handle_404(request, response, *args, **kwargs):
            url_prefix = request.forwarded_uri[:-1]
            if request.path and request.path != "/":
                url_prefix = request.forwarded_uri.split(request.path)[0]

            to_return = OrderedDict()
            to_return['404'] = ("The API call you tried to make was not defined. "
                                "Here's a definition of the API to help you get going :)")
            to_return['documentation'] = self.documentation(base_url, self.determine_version(request, False),
                                                            prefix=url_prefix)

            if self.output_format == hug.output_format.json:
                response.data = hug.output_format.json(to_return, indent=4, separators=(',', ': '))
                response.content_type = 'application/json; charset=utf-8'
            else:
                response.data = self.output_format(to_return, request=request, response=response)
                response.content_type = self.output_format.content_type

            response.status = falcon.HTTP_NOT_FOUND

        handle_404.interface = True
        return handle_404
266647
def retrieve_http(options)
        file_size = options.fetch(:file_size)
        headers = options.fetch(:headers)
        url = options.fetch(:url)
        retrieved = 0

        request = Typhoeus::Request.new(url.to_s, method: :get, headers: headers)
        request.on_headers do |response|
          raise DownloadError.new("#{self.class}: Failed to download #{url}: Status Code: #{response.code}", response) unless response.code == 200
        end
        request.on_body do |chunk|
          retrieved += chunk.bytesize
          yield(chunk, retrieved, file_size)
        end
        request.run
      end
952555
def custom_404_body
      filename = File.join(root, "404.html")

      File.exist?(filename) ? File.binread(filename) : nil
    end
378318
function methodLoader(modules) {
  return function(req, res, next) {
    if (req.path === '/') return next();

    var path = req.path.substr(1).split('/');
    var currModule = modules;
    var isLastIndex, p, method;

    debug('Looking for isomorphine entity in: ' + path.join('.'));

    for (var i = 0, len = path.length; i < len; i++) {
      isLastIndex = i === (len - 1);
      p = path[i];

      // Expect a function when last index
      if (isLastIndex && isES6Function(currModule[p])) {
        method = getES6Function(currModule[p]);
      }

      // Expect an object when not last index
      else if (!isLastIndex && isObject(currModule[p])) {
        currModule = currModule[p];
      }

      // Return a 404 if the entity was not found
      else {
        return next(createError(404, 'No method found at this path'));
      }
    }

    // Reference the serverside method in req
    debug('Entity found');
    req.serversideMethod = method;

    next();
  };
}
82644
def load_http_response(cls, http_response):
        
        if not http_response.ok:
            raise APIResponseError(http_response.text)
        c = cls(http_response)
        c.response = http_response

        RateLimits.getRateLimits(cls.__name__).set(c.response.headers)

        return c
752514
def _http_response(self, url, method, data=None, **kwargs):
        
        header = {'content-type': 'application/json'}

        if data:
            data = json.dumps(data)
        path = url.format(**kwargs)
        logger.debug("%s %s", method.__name__.upper(), path)
        response = method(self.host + path,
                          data=data, headers=header, **self.method_kwargs)
        logger.debug("%s %s", response.status_code, response.reason)
        response.raise_for_status()

        return response
1216964
def not_found(cls, errors=None):
        
        if cls.expose_status:  # pragma: no cover
            cls.response.content_type = 'application/json'
            cls.response._status_line = '404 Not Found'

        return cls(404, None, errors).to_json
165413
function http404 (req, res, next) {
  if (req.swagger && req.swagger.api && !req.swagger.path) {
    util.debug(
      'Client requested path "%s", which is not defined in the Swagger API. Returning HTTP 404 (Not Found)',
      req.path
    );
    throw ono({ status: 404 }, "Resource not found: %s", req.path);
  }

  next();
}
111966
def load(*args, **kwargs):
    
    kwargs.update(dict(object_hook=json_numpy_obj_hook))
    return _json.load(*args, **kwargs)
1175470
def handler404(request, template_name='404.html'):
    
    t = loader.get_template(template_name) # You need to create a 404.html template.
    return http.HttpResponseNotFound(t.render(Context({
        'MEDIA_URL': settings.MEDIA_URL,
        'STATIC_URL': settings.STATIC_URL
    })))
1063403
def _load_result(response, ret):
    '''
    
    '''

    #were we able to connect?
    if response['code'] is None:
        ret['comment'] = response['content']
    #forbidden?
    elif response['code'] == 401:
        ret['comment'] = '401 Forbidden: Authentication required!'
    #Not found?
    elif response['code'] == 404:
        ret['comment'] = response['content']['message']
    #200?
    elif response['code'] == 200:
        ret['result'] = True
        ret['comment'] = 'Listing Current Configuration Only.  ' \
                         'Not action or changes occurred during the execution of this state.'
        ret['changes'] = response['content']
    #something bad
    else:
        ret['comment'] = response['content']['message']

    return ret
183257
def _request(self, method, url, query_or_data=None, **kwargs):
        

        if query_or_data is None:
            query_or_data = {}

        request_method = getattr(self, '_http_{0}'.format(method))
        response = retry_request(self)(request_method)(url, query_or_data, **kwargs)

        if self.raw_mode:
            return response

        if response.status_code >= 300:
            error = get_error(response)
            if self.raise_errors:
                raise error
            return error

        # Return response object on NoContent
        if response.status_code == 204 or not response.text:
            return response

        return ResourceBuilder(
            self,
            self.default_locale,
            response.json()
        ).build()
386739
def load(source, **kwargs) -> JsonObj:
    
    if isinstance(source, str):
        if '://' in source:
            req = Request(source)
            req.add_header("Accept", "application/json, text/json;q=0.9")
            with urlopen(req) as response:
                jsons = response.read()
        else:
            with open(source) as f:
                jsons = f.read()
    elif hasattr(source, "read"):
        jsons = source.read()
    else:
        raise TypeError("Unexpected type {} for source {}".format(type(source), source))

    return loads(jsons, **kwargs)