Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using application/geo+json as the media type for Accept header results in a 500 error #1108

Closed
jerstlouis opened this issue Jan 18, 2023 · 3 comments
Labels
bug Something isn't working stale Issue marked stale by stale-bot

Comments

@jerstlouis
Copy link

Description
Using application/geo+json as the media type (the correct media type for GeoJSON) in an Accept: header results in a 500 error (with Skymantics Aviation API deployment).

Steps to Reproduce
Steps to reproduce the behavior:

curl -H "Accept: application/geo+json" https://aviationapi.skymantics.com/faa/collections/faa_flight_plans/items/000d76cb-b772-470d-8efd-bb04466ddd96

and

curl https://aviationapi.skymantics.com/faa/collections/faa_flight_plans/items/000d76cb-b772-470d-8efd-bb04466ddd96

both result in a 500 internal server error.

However, these requests from demo.pygeoapi.io work fine:

curl -H "Accept: application/geo+json" https://demo.pygeoapi.io/stable/collections/lakes/items/0
curl https://demo.pygeoapi.io/stable/collections/lakes/items/0

Expected behavior
Negotiating application/geo+json should work fine, as it is the correct media type for GeoJSON.

Screenshots/Tracebacks

curl https://aviationapi.skymantics.com/faa/collections/faa_flight_plans/items/000d76cb-b772-470d-8efd-bb04466ddd96
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>KeyError: None // Werkzeug Debugger</title>
    <link rel="stylesheet" href="?__debugger__=yes&amp;cmd=resource&amp;f=style.css"
        type="text/css">
    <!-- We need to make sure this has a favicon so that the debugger does
         not by accident trigger a request to /favicon.ico which might
         change the application state. -->
    <link rel="shortcut icon"
        href="?__debugger__=yes&amp;cmd=resource&amp;f=console.png">
    <script src="?__debugger__=yes&amp;cmd=resource&amp;f=jquery.js"></script>
    <script src="?__debugger__=yes&amp;cmd=resource&amp;f=debugger.js"></script>
    <script type="text/javascript">
      var TRACEBACK = 140051253902688,
          CONSOLE_MODE = false,
          EVALEX = true,
          EVALEX_TRUSTED = false,
          SECRET = "Im4VUu1EHLeEBsBvsCPl";
    </script>
  </head>
  <body style="background-color: #fff">
    <div class="debugger">
<h1>KeyError</h1>
<div class="detail">
  <p class="errormsg">KeyError: None</p>
</div>
<h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
<div class="traceback">
  
  <ul><li><div class="frame" id="frame-140051180588528">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py"</cite>,
      line <em class="line">2464</em>,
      in <code class="function">__call__</code></h4>
  <div class="source "><pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>def __call__(self, environ, start_response):</pre>
<pre class="line before"><span class="ws">        </span>&quot;&quot;&quot;The WSGI server calls the Flask application object as the</pre>
<pre class="line before"><span class="ws">        </span>WSGI application. This calls :meth:`wsgi_app` which can be</pre>
<pre class="line before"><span class="ws">        </span>wrapped to applying middleware.&quot;&quot;&quot;</pre>
<pre class="line current"><span class="ws">        </span>return self.wsgi_app(environ, start_response)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def __repr__(self):</pre>
<pre class="line after"><span class="ws">        </span>return &quot;&lt;%s %r&gt;&quot; % (self.__class__.__name__, self.name)</pre></div>
</div>

<li><div class="frame" id="frame-140051180588288">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py"</cite>,
      line <em class="line">2450</em>,
      in <code class="function">wsgi_app</code></h4>
  <div class="source "><pre class="line before"><span class="ws">            </span>try:</pre>
<pre class="line before"><span class="ws">                </span>ctx.push()</pre>
<pre class="line before"><span class="ws">                </span>response = self.full_dispatch_request()</pre>
<pre class="line before"><span class="ws">            </span>except Exception as e:</pre>
<pre class="line before"><span class="ws">                </span>error = e</pre>
<pre class="line current"><span class="ws">                </span>response = self.handle_exception(e)</pre>
<pre class="line after"><span class="ws">            </span>except:  # noqa: B001</pre>
<pre class="line after"><span class="ws">                </span>error = sys.exc_info()[1]</pre>
<pre class="line after"><span class="ws">                </span>raise</pre>
<pre class="line after"><span class="ws">            </span>return response(environ, start_response)</pre>
<pre class="line after"><span class="ws">        </span>finally:</pre></div>
</div>

<li><div class="frame" id="frame-140051180588432">
  <h4>File <cite class="filename">"/usr/local/lib/python3.8/dist-packages/flask_cors/extension.py"</cite>,
      line <em class="line">165</em>,
      in <code class="function">wrapped_function</code></h4>
  <div class="source library"><pre class="line before"><span class="ws">        </span># Wrap exception handlers with cross_origin</pre>
<pre class="line before"><span class="ws">        </span># These error handlers will still respect the behavior of the route</pre>
<pre class="line before"><span class="ws">        </span>if options.get('intercept_exceptions', True):</pre>
<pre class="line before"><span class="ws">            </span>def _after_request_decorator(f):</pre>
<pre class="line before"><span class="ws">                </span>def wrapped_function(*args, **kwargs):</pre>
<pre class="line current"><span class="ws">                    </span>return cors_after_request(app.make_response(f(*args, **kwargs)))</pre>
<pre class="line after"><span class="ws">                </span>return wrapped_function</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">            </span>if hasattr(app, 'handle_exception'):</pre>
<pre class="line after"><span class="ws">                </span>app.handle_exception = _after_request_decorator(</pre>
<pre class="line after"><span class="ws">                    </span>app.handle_exception)</pre></div>
</div>

<li><div class="frame" id="frame-140051180585312">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py"</cite>,
      line <em class="line">1867</em>,
      in <code class="function">handle_exception</code></h4>
  <div class="source "><pre class="line before"><span class="ws">            </span># if we want to repropagate the exception, we can attempt to</pre>
<pre class="line before"><span class="ws">            </span># raise it with the whole traceback in case we can do that</pre>
<pre class="line before"><span class="ws">            </span># (the function was actually called from the except part)</pre>
<pre class="line before"><span class="ws">            </span># otherwise, we just raise the error again</pre>
<pre class="line before"><span class="ws">            </span>if exc_value is e:</pre>
<pre class="line current"><span class="ws">                </span>reraise(exc_type, exc_value, tb)</pre>
<pre class="line after"><span class="ws">            </span>else:</pre>
<pre class="line after"><span class="ws">                </span>raise e</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">        </span>self.log_exception((exc_type, exc_value, tb))</pre>
<pre class="line after"><span class="ws">        </span>server_error = InternalServerError()</pre></div>
</div>

<li><div class="frame" id="frame-140051180585120">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/_compat.py"</cite>,
      line <em class="line">39</em>,
      in <code class="function">reraise</code></h4>
  <div class="source "><pre class="line before"><span class="ws">    </span>import collections.abc as collections_abc</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>def reraise(tp, value, tb=None):</pre>
<pre class="line before"><span class="ws">        </span>if value.__traceback__ is not tb:</pre>
<pre class="line before"><span class="ws">            </span>raise value.with_traceback(tb)</pre>
<pre class="line current"><span class="ws">        </span>raise value</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>implements_to_string = _identity</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span>else:</pre>
<pre class="line after"><span class="ws">    </span>iterkeys = lambda d: d.iterkeys()</pre></div>
</div>

<li><div class="frame" id="frame-140051180588096">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py"</cite>,
      line <em class="line">2447</em>,
      in <code class="function">wsgi_app</code></h4>
  <div class="source "><pre class="line before"><span class="ws">        </span>ctx = self.request_context(environ)</pre>
<pre class="line before"><span class="ws">        </span>error = None</pre>
<pre class="line before"><span class="ws">        </span>try:</pre>
<pre class="line before"><span class="ws">            </span>try:</pre>
<pre class="line before"><span class="ws">                </span>ctx.push()</pre>
<pre class="line current"><span class="ws">                </span>response = self.full_dispatch_request()</pre>
<pre class="line after"><span class="ws">            </span>except Exception as e:</pre>
<pre class="line after"><span class="ws">                </span>error = e</pre>
<pre class="line after"><span class="ws">                </span>response = self.handle_exception(e)</pre>
<pre class="line after"><span class="ws">            </span>except:  # noqa: B001</pre>
<pre class="line after"><span class="ws">                </span>error = sys.exc_info()[1]</pre></div>
</div>

<li><div class="frame" id="frame-140051180588576">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py"</cite>,
      line <em class="line">1952</em>,
      in <code class="function">full_dispatch_request</code></h4>
  <div class="source "><pre class="line before"><span class="ws">            </span>request_started.send(self)</pre>
<pre class="line before"><span class="ws">            </span>rv = self.preprocess_request()</pre>
<pre class="line before"><span class="ws">            </span>if rv is None:</pre>
<pre class="line before"><span class="ws">                </span>rv = self.dispatch_request()</pre>
<pre class="line before"><span class="ws">        </span>except Exception as e:</pre>
<pre class="line current"><span class="ws">            </span>rv = self.handle_user_exception(e)</pre>
<pre class="line after"><span class="ws">        </span>return self.finalize_request(rv)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def finalize_request(self, rv, from_error_handler=False):</pre>
<pre class="line after"><span class="ws">        </span>&quot;&quot;&quot;Given the return value from a view function this finalizes</pre>
<pre class="line after"><span class="ws">        </span>the request by converting it into a response and invoking the</pre></div>
</div>

<li><div class="frame" id="frame-140051180587232">
  <h4>File <cite class="filename">"/usr/local/lib/python3.8/dist-packages/flask_cors/extension.py"</cite>,
      line <em class="line">165</em>,
      in <code class="function">wrapped_function</code></h4>
  <div class="source library"><pre class="line before"><span class="ws">        </span># Wrap exception handlers with cross_origin</pre>
<pre class="line before"><span class="ws">        </span># These error handlers will still respect the behavior of the route</pre>
<pre class="line before"><span class="ws">        </span>if options.get('intercept_exceptions', True):</pre>
<pre class="line before"><span class="ws">            </span>def _after_request_decorator(f):</pre>
<pre class="line before"><span class="ws">                </span>def wrapped_function(*args, **kwargs):</pre>
<pre class="line current"><span class="ws">                    </span>return cors_after_request(app.make_response(f(*args, **kwargs)))</pre>
<pre class="line after"><span class="ws">                </span>return wrapped_function</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">            </span>if hasattr(app, 'handle_exception'):</pre>
<pre class="line after"><span class="ws">                </span>app.handle_exception = _after_request_decorator(</pre>
<pre class="line after"><span class="ws">                    </span>app.handle_exception)</pre></div>
</div>

<li><div class="frame" id="frame-140051180586272">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py"</cite>,
      line <em class="line">1821</em>,
      in <code class="function">handle_user_exception</code></h4>
  <div class="source "><pre class="line before"><span class="ws">            </span>return self.handle_http_exception(e)</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">        </span>handler = self._find_error_handler(e)</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">        </span>if handler is None:</pre>
<pre class="line current"><span class="ws">            </span>reraise(exc_type, exc_value, tb)</pre>
<pre class="line after"><span class="ws">        </span>return handler(e)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def handle_exception(self, e):</pre>
<pre class="line after"><span class="ws">        </span>&quot;&quot;&quot;Handle an exception that did not have an error handler</pre>
<pre class="line after"><span class="ws">        </span>associated with it, or that was raised from an error handler.</pre></div>
</div>

<li><div class="frame" id="frame-140051180586128">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/_compat.py"</cite>,
      line <em class="line">39</em>,
      in <code class="function">reraise</code></h4>
  <div class="source "><pre class="line before"><span class="ws">    </span>import collections.abc as collections_abc</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>def reraise(tp, value, tb=None):</pre>
<pre class="line before"><span class="ws">        </span>if value.__traceback__ is not tb:</pre>
<pre class="line before"><span class="ws">            </span>raise value.with_traceback(tb)</pre>
<pre class="line current"><span class="ws">        </span>raise value</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>implements_to_string = _identity</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span>else:</pre>
<pre class="line after"><span class="ws">    </span>iterkeys = lambda d: d.iterkeys()</pre></div>
</div>

<li><div class="frame" id="frame-140051180588768">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py"</cite>,
      line <em class="line">1950</em>,
      in <code class="function">full_dispatch_request</code></h4>
  <div class="source "><pre class="line before"><span class="ws">        </span>self.try_trigger_before_first_request_functions()</pre>
<pre class="line before"><span class="ws">        </span>try:</pre>
<pre class="line before"><span class="ws">            </span>request_started.send(self)</pre>
<pre class="line before"><span class="ws">            </span>rv = self.preprocess_request()</pre>
<pre class="line before"><span class="ws">            </span>if rv is None:</pre>
<pre class="line current"><span class="ws">                </span>rv = self.dispatch_request()</pre>
<pre class="line after"><span class="ws">        </span>except Exception as e:</pre>
<pre class="line after"><span class="ws">            </span>rv = self.handle_user_exception(e)</pre>
<pre class="line after"><span class="ws">        </span>return self.finalize_request(rv)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def finalize_request(self, rv, from_error_handler=False):</pre></div>
</div>

<li><div class="frame" id="frame-140051180587088">
  <h4>File <cite class="filename">"/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py"</cite>,
      line <em class="line">1936</em>,
      in <code class="function">dispatch_request</code></h4>
  <div class="source "><pre class="line before"><span class="ws">            </span>getattr(rule, &quot;provide_automatic_options&quot;, False)</pre>
<pre class="line before"><span class="ws">            </span>and req.method == &quot;OPTIONS&quot;</pre>
<pre class="line before"><span class="ws">        </span>):</pre>
<pre class="line before"><span class="ws">            </span>return self.make_default_options_response()</pre>
<pre class="line before"><span class="ws">        </span># otherwise dispatch to the handler for that endpoint</pre>
<pre class="line current"><span class="ws">        </span>return self.view_functions[rule.endpoint](**req.view_args)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def full_dispatch_request(self):</pre>
<pre class="line after"><span class="ws">        </span>&quot;&quot;&quot;Dispatches the request and on top of that performs request</pre>
<pre class="line after"><span class="ws">        </span>pre and postprocessing as well as HTTP exception catching and</pre>
<pre class="line after"><span class="ws">        </span>error handling.</pre></div>
</div>

<li><div class="frame" id="frame-140051180586560">
  <h4>File <cite class="filename">"/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/flask_app.py"</cite>,
      line <em class="line">199</em>,
      in <code class="function">collection_items</code></h4>
  <div class="source library"><pre class="line before"><span class="ws">            </span>return get_response(</pre>
<pre class="line before"><span class="ws">                </span>api_.post_collection_items(request, collection_id))</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>else:</pre>
<pre class="line before"><span class="ws">        </span>return get_response(</pre>
<pre class="line current"><span class="ws">            </span>api_.get_collection_item(request, collection_id, item_id))</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span>@BLUEPRINT.route('/collections/&lt;collection_id&gt;/coverage')</pre>
<pre class="line after"><span class="ws"></span>def collection_coverage(collection_id):</pre>
<pre class="line after"><span class="ws">    </span>&quot;&quot;&quot;</pre></div>
</div>

<li><div class="frame" id="frame-140051180587136">
  <h4>File <cite class="filename">"/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/api.py"</cite>,
      line <em class="line">142</em>,
      in <code class="function">inner</code></h4>
  <div class="source library"><pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">    </span>def inner(*args):</pre>
<pre class="line before"><span class="ws">        </span>cls, req_in = args[:2]</pre>
<pre class="line before"><span class="ws">        </span>req_out = APIRequest.with_data(req_in, getattr(cls, 'locales', set()))</pre>
<pre class="line before"><span class="ws">        </span>if len(args) &gt; 2:</pre>
<pre class="line current"><span class="ws">            </span>return func(cls, req_out, *args[2:])</pre>
<pre class="line after"><span class="ws">        </span>else:</pre>
<pre class="line after"><span class="ws">            </span>return func(cls, req_out)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>return inner</pre>
<pre class="line after"><span class="ws"></span> </pre></div>
</div>

<li><div class="frame" id="frame-140051180586992">
  <h4>File <cite class="filename">"/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/api.py"</cite>,
      line <em class="line">1915</em>,
      in <code class="function">get_collection_item</code></h4>
  <div class="source library"><pre class="line before"><span class="ws">        </span># JSON-FG. BUG en codigo original. Links a prev y next apuntan a self</pre>
<pre class="line before"><span class="ws">        </span>if 'prev' in content:</pre>
<pre class="line before"><span class="ws">            </span>content['links'].append(</pre>
<pre class="line before"><span class="ws">                </span>{</pre>
<pre class="line before"><span class="ws">                    </span>'rel': 'prev',</pre>
<pre class="line current"><span class="ws">                    </span>'type': FORMAT_TYPES[request.format],</pre>
<pre class="line after"><span class="ws">                    </span>'href': '{}/collections/{}/items/{}?f={}'.format(self.config['server']['url'], dataset, content['prev'], request.format)</pre>
<pre class="line after"><span class="ws">                </span>})</pre>
<pre class="line after"><span class="ws">        </span>if 'next' in content:</pre>
<pre class="line after"><span class="ws">            </span>content['links'].append(</pre>
<pre class="line after"><span class="ws">                </span>{</pre></div>
</div>
</ul>
  <blockquote>KeyError: None</blockquote>
</div>

<div class="plain">
  <form action="/?__debugger__=yes&amp;cmd=paste" method="post">
    <p>
      <input type="hidden" name="language" value="pytb">
      This is the Copy/Paste friendly version of the traceback.  <span
      class="pastemessage">You can also paste this traceback into
      a <a href="https://gist.github.com/">gist</a>:
      <input type="submit" value="create paste"></span>
    </p>
    <textarea cols="50" rows="10" name="code" readonly>Traceback (most recent call last):
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py&quot;, line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py&quot;, line 2450, in wsgi_app
    response = self.handle_exception(e)
  File &quot;/usr/local/lib/python3.8/dist-packages/flask_cors/extension.py&quot;, line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py&quot;, line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/_compat.py&quot;, line 39, in reraise
    raise value
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py&quot;, line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py&quot;, line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File &quot;/usr/local/lib/python3.8/dist-packages/flask_cors/extension.py&quot;, line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py&quot;, line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/_compat.py&quot;, line 39, in reraise
    raise value
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py&quot;, line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File &quot;/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py&quot;, line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File &quot;/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/flask_app.py&quot;, line 199, in collection_items
    api_.get_collection_item(request, collection_id, item_id))
  File &quot;/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/api.py&quot;, line 142, in inner
    return func(cls, req_out, *args[2:])
  File &quot;/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/api.py&quot;, line 1915, in get_collection_item
    'type': FORMAT_TYPES[request.format],
KeyError: None</textarea>
  </form>
</div>
<div class="explanation">
  The debugger caught an exception in your WSGI application.  You can now
  look at the traceback which led to the error.  <span class="nojavascript">
  If you enable JavaScript you can also use additional features such as code
  execution (if the evalex feature is enabled), automatic pasting of the
  exceptions and much more.</span>
</div>
      <div class="footer">
        Brought to you by <strong class="arthur">DON'T PANIC</strong>, your
        friendly Werkzeug powered traceback interpreter.
      </div>
    </div>

    <div class="pin-prompt">
      <div class="inner">
        <h3>Console Locked</h3>
        <p>
          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.
        <form>
          <p>PIN:
            <input type=text name=pin size=14>
            <input type=submit name=btn value="Confirm Pin">
        </form>
      </div>
    </div>
  </body>
</html>

<!--

Traceback (most recent call last):
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/icorreas/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/flask_app.py", line 199, in collection_items
    api_.get_collection_item(request, collection_id, item_id))
  File "/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/api.py", line 142, in inner
    return func(cls, req_out, *args[2:])
  File "/usr/local/lib/python3.8/dist-packages/pygeoapi-0.11.dev0-py3.8.egg/pygeoapi/api.py", line 1915, in get_collection_item
    'type': FORMAT_TYPES[request.format],
KeyError: None

-->

Environment
Skymantics Aviation API ( Powered by pygeoapi logo 0.11.dev0 )

Additional context

In the context of Testbed 18 / SWIM task.

@skyNacho provided this additional feedback:

pygeopai hardcodes the media type as application/json instead of application/geo+json. So when you query specifying the media type as application/geo+json, pygeoapi does not recognize it as a valid media type and returns an error. You can see the piece of code in api.py, line 101:

    #: Formats allowed for ?f= requests (order matters for complex MIME types)
    FORMAT_TYPES = OrderedDict((
    (F_HTML, 'text/html'),
    (F_JSONLD, 'application/ld+json'),
    (F_JSON, 'application/json'),
    (F_PNG, 'image/png'),
    (F_MVT, 'application/vnd.mapbox-vector-tile')
    ))

The solution can be as simple as replacing application/json with application/geo+json but it might generate issues with existing applications. I think it is a good idea to open the debate in the broader community.

@tomkralidis

@jerstlouis jerstlouis added the bug Something isn't working label Jan 18, 2023
@tomkralidis
Copy link
Member

@skyNacho can you test against pygeoapi master?

Copy link

As per RFC4, this Issue has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days.

@github-actions github-actions bot added the stale Issue marked stale by stale-bot label Mar 10, 2024
Copy link

As per RFC4, this Issue has been closed due to there being no activity for more than 90 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Issue marked stale by stale-bot
Projects
None yet
Development

No branches or pull requests

2 participants