Async possible?
h
QuantumCodes

if i want to ping many websites at once (using requests library) it takes a long time.. is it possible that it first pings web1, then withoutnwaiting for output, pings 2 then waits till both gets pinged?

Current code: how do i change it?

Takes approx 0.5 to 0.8 or even 1 second to complete 1 loop of while true excluding time.sleep

You are viewing a single comment. View All
InvisibleOne

I would try threading, that way you can run a whole bunch of threads.

This way it won't wait for that thread to be done, it will just move on to creating another thread without waiting for that ping to be made.

QuantumCodes
QuantumCodes

Is threading better thatn asyncio? @InvisibleOne

QuantumCodes

@InvisibleOne wait..... thread.join() waits. Is there anything wrong?

InvisibleOne

I didn't mean to put that in there, this code was adapted from another program I wrote and I just left that there. @QuantumCodes

InvisibleOne

I haven't really used asyncio so I don't know which one is better @QuantumCodes

QuantumCodes