Combining Multiprocessing.map() and itertools.cycle in python3

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Combining Multiprocessing.map() and itertools.cycle in python3



my question is how can I utilize itertools.cycle with multiprocessing in a way that my end result allows me to iterate through the 'accounts' file which is an email:password list as well as provide a new proxy to each request I make(in each process created with multiprocessing.map). This is somewhat hard to explain so I have provided my current code to help illustrate my problem. In each of the allocated processes(processes=10), the email combination changes for every post request but the proxy changes every 10 requests. I want every request to be completely unique. My issue seems to be that I am relying on each process created to switch the proxy with the next() function. Results are below. Thanks in advance!


import requests
def main(account):
proxy_switch = next(proxy_pool)
proxy = {"http": proxy_switch}
requests.post(url, proxies=proxy)

accounts=open('file.txt').readlines()
proxy_file=open('proxies.txt').readlines()
proxy_pool = cycle(proxy_file)
if __name__ == "__main__":
p = Pool(processes=10)
p.map(main, accounts)









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

xwJJlcSIvxKshZ m8,7RZ9f,48cqG,x4VAx2KcWRlI7T1F A8,DceQUJPdr9F YlUqYUq,Sfk8 gonQELu6SiAUKr
gcNd7qwKCWT qDk6pqMTu9rK2e4 u4G

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results