KeyError: "Unknown dataset type 's1_l3comp_swiss'"
__call__
def __call__(self, environ: dict, start_response: t.Callable) -> t.Any:
"""The WSGI server calls the Flask application object as the
WSGI application. This calls :meth:`wsgi_app`, which can be
wrapped to apply middleware.
"""
return self.wsgi_app(environ, start_response)
__call__
self.x_prefix, environ_get("HTTP_X_FORWARDED_PREFIX")
)
if x_prefix:
environ["SCRIPT_NAME"] = x_prefix
return self.app(environ, start_response)
wsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
wrapped_function
# Wrap exception handlers with cross_origin
# These error handlers will still respect the behavior of the route
if options.get('intercept_exceptions', True):
def _after_request_decorator(f):
def wrapped_function(*args, **kwargs):
return cors_after_request(app.make_response(f(*args, **kwargs)))
return wrapped_function
if hasattr(app, 'handle_exception'):
app.handle_exception = _after_request_decorator(
app.handle_exception)
wsgi_app
ctx = self.request_context(environ)
error: t.Optional[BaseException] = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
full_dispatch_request
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
self,
rv: t.Union[ft.ResponseReturnValue, HTTPException],
wrapped_function
# Wrap exception handlers with cross_origin
# These error handlers will still respect the behavior of the route
if options.get('intercept_exceptions', True):
def _after_request_decorator(f):
def wrapped_function(*args, **kwargs):
return cors_after_request(app.make_response(f(*args, **kwargs)))
return wrapped_function
if hasattr(app, 'handle_exception'):
app.handle_exception = _after_request_decorator(
app.handle_exception)
full_dispatch_request
self.try_trigger_before_first_request_functions()
try:
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
dispatch_request
getattr(rule, "provide_automatic_options", False)
and req.method == "OPTIONS"
):
return self.make_default_options_response()
# otherwise dispatch to the handler for that endpoint
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
def full_dispatch_request(self) -> Response:
"""Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.
regions_geojson
@bp.route("/regions/<product_name>/<int:year>/<int:month>")
@bp.route("/regions/<product_name>/<int:year>/<int:month>/<int:day>")
def regions_geojson(
product_name: str, year: int = None, month: int = None, day: int = None
):
regions = _model.get_regions_geojson(product_name, year, month, day)
if regions is None:
abort(404, f"{product_name} does not have regions")
return as_geojson(
regions, downloadable_filename_prefix=_utils.api_path_as_filename_prefix()
)
decorated_function
raise
logger.exception("Exception possibly due to cache backend.")
return self._call_fn(f, *args, **kwargs)
if not found:
rv = self._call_fn(f, *args, **kwargs)
if inspect.isgenerator(rv):
rv = [val for val in rv]
if response_filter is None or response_filter(rv):
try:
_call_fn
self.app = app
def _call_fn(self, fn, *args, **kwargs):
ensure_sync = getattr(self.app, "ensure_sync", None)
if ensure_sync is not None:
return ensure_sync(fn)(*args, **kwargs)
return fn(*args, **kwargs)
@property
def cache(self) -> SimpleCache:
app = current_app or self.app
get_regions_geojson
product_name: str,
year: Optional[int] = None,
month: Optional[int] = None,
day: Optional[int] = None,
) -> Optional[Dict]:
product = STORE.get_dataset_type(product_name)
region_info = STORE.get_product_region_info(product_name)
if not region_info:
return None
wrapper
hits += 1
return result
except KeyError:
with lock:
misses += 1
v = func(*args, **kwargs)
# in case of a race, prefer the item already in the cache
try:
with lock:
return cache.setdefault(k, v)
except ValueError:
get_dataset_type
@ttl_cache(ttl=DEFAULT_TTL)
def get_dataset_type(self, name) -> DatasetType:
for d in self.all_dataset_types():
if d.name == name:
return d
raise KeyError(f"Unknown dataset type {name!r}")
@ttl_cache(ttl=DEFAULT_TTL)
def _dataset_type_by_id(self, id_) -> DatasetType:
for d in self.all_dataset_types():
if d.id == id_:
KeyError: "Unknown dataset type 's1_l3comp_swiss'"
This is the Copy/Paste friendly version of the traceback.
The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.