Пример #1
0
def items4():
    with open('products.csv') as f:
        while True:
            line1 = f.readline()
            if not line1:
                break
            line2 = f.readline()
            line3 = f.readline()
            line4 = f.readline()
            f.write(line1 + ';' + AllBoxxParser.products(line1.split(';')[3]))
            f.write(line2 + ';' + AllBoxxParser.products(line2.split(';')[3]))
            f.write(line3 + ';' + AllBoxxParser.products(line3.split(';')[3]))
            f.write(line4 + ';' + AllBoxxParser.products(line4.split(';')[3]))
            time.sleep(random.randint(1,3))
            

# items()        
Пример #2
0
 def run(self):
     prds = AllBoxxSingleton.AllBoxxSingleton()
     failed = OnlyOne.OnlyOne()
     items = []
     for url in self.urls:
         current_item = url.split(';')[3]
         try:
             updated_line = url.replace('\n', '') + ";" +  AllBoxxParser.products(current_item)
             print(current_item)
             items.append(updated_line)
         except Exception as e:
             print(bcolors.FAIL + current_item + ' in Thread ' + self.name + bcolors.ENDC + ' ' + str(e))
             self.urls.append(url)
             time.sleep(5)
     f = open(self.name + '.csv', 'w')
     for x in items:
         f.write(x)
     f.close()
Пример #3
0
def items():
    f = open('c_products.csv', 'w')
    for x in open('products.csv', 'r'):
        f.write(x + ';' + AllBoxxParser.products(x.split(';')[3]))
    f.close()