Самый простой вариант, как равномерно размазывать нагрузку:
from collections import deque
from concurrent.futures import ThreadPoolExecutor
def load_proxies():
with open('proxy.txt') as f:
return deque([row.strip() for row in f])
def get_article(proxies, link):
proxy = proxies.popleft()
try:
print("working with proxy", proxy, link)
finally:
proxies.append(proxy)
def main():
proxies = load_proxies()
with ThreadPoolExecutor(max_workers=50) as pool:
pool.map(lambda link: get_article(proxies, link), ["link1", "link2"])
if __name__ == "__main__":
main()