w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Python multi-threading missing jobs
from threading import *

submits = [[1,2,3], [3,4,5], [6,7,8]]    

class worker(Thread):
    def __init__(self, site, postdata, data):
        Thread.__init__(self)
        self.data = data
        self.site = site
        self.postdata = postdata
        self.start()
    def run(self):
        for i in self.data:
            browser.open("http://example.com/jobs.php?actions="+str(i))
            browser.open(self.site, self.postdata)
for obj in submits:
    worker('http://example.com/managament.php?', {'UserID' : '',
'Action':'Delete'}, submits)

Since the OP asked for it, here's a condensed/compressed version of the code.

or:

for index in range(0,1000):
    worker('http://example.com/managament.php?', {'UserID' : '',
'Action':'Delete'}, [i for i in range(1,4)])

If the data you want to send actually is a sequence of 3 integers (1,2,3) that inclines in a perfect order.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.