Questions tagged [quart]

Quart is a microframework for developing web applications using Python's asyncio library.

Quart is an evolution of the Flask API to work with Asyncio and to provide a number of features not present or possible in Flask.

Compatibility with the Flask API is, however, the main aim, which means that the Flask documentation is an additional useful source of help.

The latest documentation for Quart can be found here

Quart is developed on GitLab. You are very welcome to open issues or propose merge requests.

91 questions
9
votes
1 answer

calling sync functions from async function

I am in the process of trying to port a flask app to quart to utilise asyncio. I don't think my current approach is working, as my entire function chain is written without async in mind - consider the following: def long_running_task(task): …
chris
  • 4,197
  • 3
  • 31
  • 60
7
votes
3 answers

Python asyncio skip processing untill function return

I'm still very confused about how asyncio works, so I was trying to set a simple example but couldn't achieve it. The following example is a web server (Quart) that receives a request to generate a large PDF, the server then returns a response…
Mojimi
  • 1,651
  • 5
  • 30
  • 81
7
votes
1 answer

With Flask or Quart NameError: global name 'g' is not defined

I got a problem when I tried to test a flask app that I can not access the g variable. The api which is gonna tested looks like this: user = query_object.get(g.user_id) # here the exception raises When I run the test, it raises: NameError: global…
streethacker
  • 268
  • 3
  • 13
6
votes
2 answers

RuntimeError: Task got Future attached to a different loop

How to call async method which get event loop in main thread inside another async method in Quart? t.py from telethon import TelegramClient, functions, types client2 = TelegramClient(sn, api_id, api_hash).start() async def create_contact(): …
Smart Manoj
  • 3,837
  • 2
  • 24
  • 45
4
votes
1 answer

RuntimeError: Event loop is closed

I'm trying to marry pyppeteer and quart, but since starting the browser takes a lot of time, I'd rather handle it globally (with an async lock), which seems to mean that I need to handle cleanup manually. Here's my minimal code…
d33tah
  • 8,728
  • 10
  • 51
  • 128
4
votes
1 answer

How to obtain an event loop from Quart

Hello I fairly new to Python and I am trying to convert an existing application I have on Flask into Quart (https://gitlab.com/pgjones/quart) which is supposed to be built on top of asyncio, so I can use Goblin OGM to interact with JanusGraph or…
Cracoras
  • 277
  • 2
  • 12
3
votes
1 answer

How do I send a file stream using Quart in Python?

Following the example set in Izmailoff's blog post, I was able to send remote files from Flask to the user, but when I switched to Quart, I started receiving a TypeError: 'function' object is not iterable error. The code is almost the exact same as…
3
votes
1 answer

Detect client disconnect in Python / Quart with websockets

I have multiple clients, wich i store in a list (connected). When a client (browser) is closed, i want to remove this websocket from the list of connected websockets. I've tried the method that pgjones wrote with some little alteration…
socialb
  • 135
  • 8
2
votes
1 answer

How can a Quart app benefit from using multiple workers?

I am trying out Quart with Hypercorn in Python 3.8. From what I understand, Quart is typically used for single threaded applications. But I see that Hypercorn has a --workers option to run the app. workers w, --workers The number of…
Rocket
  • 23
  • 1
  • 4
2
votes
0 answers

Quart Python Error: jinja2.exceptions.TemplateSyntaxError: expected token ',', got 'string'

I code a discord panel and I would like to put a text in another variable with quart python:
Jourdelune
  • 61
  • 4
2
votes
2 answers

Deploying a Quart Python app in Google App Engine

I'm trying to deploy a Quart based python app via Google Cloud's App Engine Standard. However, I keep getting the following error: Traceback (most recent call last): File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 284, in…
2
votes
1 answer

Can Quart (the ASGI Flask alternative) be proxied through nginx?

I currently have a Flask app proxied behind Nginx via uWSGI. Due to my needs for asyncio and websockets, I would prefer to switch to Quart. I use nginx to manage authentication and performantly/simply serve static files. It would be nice to keep…
trbabb
  • 1,226
  • 10
  • 25
2
votes
1 answer

How to add gzip compression to Hypercorn server serving a Quart app

I have a quart app running on a hypercorn (0.6) server. (EC-2 amazon Ubuntu 18) The page loads too slow and one of the recommendations is to add gzip compression. Does anyone have experience with this? kind regards, alex
socialb
  • 135
  • 8
2
votes
2 answers

Asyncio (Quart) throwing Task attached to a different loop error when connecting to MongoDB with motor

I have created a webapp with Quart using MongoDB and using Motor.Asyncio. When the app attempts to query the DB an error is thrown: Task
blindChicken
  • 312
  • 2
  • 10
2
votes
1 answer

Autobahn websocket client in Quart (async Flask) application

Good evening everyone. I'm not quite new to this place but finally decided to register and ask for a help. I develop a web application using Quart framework (asynchronous Flask). And now as application became bigger and more complex I decided to…
Andrew K
  • 41
  • 4
1
2 3 4 5 6 7