Cleaner async I/O syntax with Qt

Patrick Stinson patrickkidd at
Mon Dec 20 18:20:23 GMT 2021


I am using QNetworkAccessManager / QNetworkRequest for my async http requests. I am trying to find a way to wrap these in a cleaner python syntax. My first though was an async context manager, effectively like this:

with qt_request(' <>') as response:
    # executed later
# executed now
print("Sent request...")

I have been reading the docs on async context managers, but haven’t gotten the concepts into my head yet. Probably because I don’t fully get the async and await keywords yet either. Maybe this is actually counter to the python language spec?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the PyQt mailing list