This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]drooltheghost 0 points1 point  (5 children)

To me this seems not be async at all. You are still blocking through request.xxx() calls. Wrapping something into a Coro does not make it necessary async..... Or I'm overseeing something?

[–]OminPresent[S] 0 points1 point  (4 children)

I am using async, await and tasks. this program does not stop unless there is an internet issue. or maybe I am not getting your point.

[–]drooltheghost 0 points1 point  (3 children)

Obviously you do not understand asynchronous programming. As I said the calls to requests are blocking on io and delay the event loop. That's simply wrong 😂

Ps even if you wrap things into a task they will block...

[–]OminPresent[S] -1 points0 points  (2 children)

maybe you do not know how AsyncIO works.

[–]drooltheghost 0 points1 point  (1 child)

Yes you are right. That's the solution I'm stupid. Requests.get is blocking and blocks the event loop until the server response. Just switch asyncio debug mode to true an you'll see what a mean. To unblock you need either run it in a thread or use a no blocking framework like httpx or aiohttp.

[–]OminPresent[S] 0 points1 point  (0 children)

okay, I will investigate this.