1

I am trying to convert my flask app to Quart ASGI, facing an issue when try to fetch request param/argument.

It gives an error when normal request is used with Quart

Example:
@app.route('/')
async def hello():
    return function(request.args.get('requestID'))

Not able to fetch param argument using request.args.get('requestID') in Quart

  • From the looks of your question I'd say you're confusing 'request header' with 'request argument' or 'request parameter'. Take a look at the [MDN web docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) on request headers. Alternatively take a look at this curl invocation: `curl -v -H "Accept: text/html" http://localhost:5000?requestID=1`. It passes the request header `Accept` and the request parameter `requestID`. – oschlueter Sep 27 '20 at 16:28
  • Thanks for pointing it out, edited the context. – venkatesh kumar Sep 28 '20 at 11:55
  • Are you certain the error is not with the `object.function` usage? I've not seen this before in Python. Could you add the actual error that is raised to your question? – pgjones Sep 28 '20 at 19:53
  • Yea you are right, there is no such thing as Object.function, that function was part of a class so i kept in that terms, sorry to confuse. So the error message i was getting is "RuntimeError: Working outside of request context. This typically means that you attempted to use functionality that needed an active HTTP request. Consult the documentation on testing for information about how to avoid this problem." – venkatesh kumar Oct 01 '20 at 14:29

0 Answers0