multiprocessing + asyncio/aiohttp for optimal online purchasing

743 Views Asked by At

I am trying to create a bot to purchase things on multiple websites in order to save me time from doing so manually. I'm having a hard time figuring out which python modules I need in order to make the most of my machine. The process to purchase an item from one website is independent from another website.

Please correct my hypothesis if you see mistakes or add improvements!

With my machine containing 8 cores, I can theoretically use multiprocessing to run 8 tasks in parallel (avoiding GIL). Let's say I also have 800 proxies (prevent banning) that I wish to split evenly to each process. On each process, I can use asyncio/aiohttp to asynchronously perform 100 POST requests to the website to attempt to purchase the product.

Results:

8 process in parallel -> each with 100 requests running asynchronously.

I was wondering if there was a better way to go about this or if there are any flaws with my approach.

0

There are 0 best solutions below