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.

167 questions
20
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,840
  • 5
  • 35
  • 66
9
votes
3 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
  • 5,230
  • 4
  • 34
  • 59
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
  • 2,561
  • 9
  • 52
  • 116
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
  • 308
  • 5
  • 13
5
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
  • 347
  • 3
  • 16
4
votes
2 answers

Error: Socket Hang Up with Postman API testing

We have deployed some APIs (few developed using Node.js/Express.js and others using Python Quart). All out our APIs are deployed using the Azure containerized instance. We have set-up periodic API monitoring through Postman. The APIs fail about 20%…
Navaneeth
  • 190
  • 1
  • 1
  • 16
4
votes
1 answer

Cleaner Dockerfile for continuumio/miniconda3 environment?

I have a Python3.9 / Quart / Hypercorn microservice which runs in a conda environment configured with an environment.yml file. The base image is continuumio/miniconda3. It took a lot of hacks to get this launching because of conda init issues…
Brendan Hill
  • 3,406
  • 4
  • 32
  • 61
4
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
  • 43
  • 1
  • 5
4
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…
4
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…
4
votes
0 answers

Is there any integration of Socket.IO for Quart?

I'm using Quart and I'd really like to use Socket.IO with it, but I couldn't find Socket.IO integration for Quart, only for Flask. Should I try the flask version or there's no way?
pqhaz
  • 41
  • 2
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
  • 10,999
  • 13
  • 68
  • 158
3
votes
1 answer

Websockets in python Quart with multiple workers?

Websockets in python Quart with multiple workers? Is there a solution to broadcast a message when my app is launched across multiple workers - for example using hypercorn? I'm currently launching my app like this: $ hypercorn -b 127.0.0.1:8000 -w 4…
go-pera
  • 31
  • 2
3
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
  • 352
  • 4
  • 13
3
votes
1 answer

Detect client disconnect in Python / Quart with websockets

I have multiple clients, which 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
  • 1
  • 9
1
2 3
11 12