Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve Quart example #1229
As the client seems tied to a specific login, I've changed it from
Note that if the client has to be global the Quart before/after
as this creates the client within the event-loop managed by
I've then made a number of more minor changes to use the template
Thank you for this, however the point of the example was to showcase some of the problems people might encounter (with this whole implicit loop mess), and a global client was the easiest way to demonstrate the issue and how it could be solved.
I agree that the new code you propose is a lot better but notice you create the client inside the
I think the best for this simple example is to keep the client global and ready to be used. Maybe we should add a note in the file security-wise, with things like setting
Also, please make consistent use of single quotes in the files, since they are used everywhere for string literals (
Is there another way to demonstrate how to control the event loop usage (does the client have a multi user mode)? I'd prefer not to contribute an example that is known to be insecure as the examples tend to be copied verbatim by beginners.
In terms of Quart I've added extra documentation I hope helps people understand this.
Thank you for the extra documentation, I actually couldn't find an asynchronous alternative to
Maybe we should just make both Quart's