Esempio n. 1
0
    def SubTask(self, driver, TaskInfo):
        Task = AmazonFunction(driver, TaskInfo)
        Task.speed = randint(100, 160)
        if not Task.login():
            return False
        time.sleep(5)
        if not Task.CleanCart():
            return False
        if not Task.SetAddress():
            return False

        for asin in TaskInfo['asins']:
            Task.FunctionInfo['asin'] = asin
            Task.FunctionInfo.update(parseinfo.ProductFrame.loc[
                Task.FunctionInfo['asin']].to_dict())
            Task.FunctionInfo['lowprice'] = str(
                round((float(Task.FunctionInfo['buyboxprice']) - 0.01), 2))
            Task.FunctionInfo['highprice'] = str(
                round((float(Task.FunctionInfo['buyboxprice']) + 0.01), 2))
            #Task.FunctionInfo['lowprice'] = Task.FunctionInfo['buyboxprice']
            #Task.FunctionInfo['highprice'] = Task.FunctionInfo['buyboxprice']
            if not Task.SearchProduct():
                print('Search production fail...')
                # Fatal error if not found in any page  TBD
                TaskInfo['errorcode'] = 'SearchFail'
                TaskInfo['status'] = False
                return False
            if not Task.AddCart():
                print('Add cart fail...')
                # Fatal error if not found TBD
                return False
        return True
Esempio n. 2
0
 def SubTask(self, driver, TaskInfo):
     driver.implicitly_wait(5)
     Task = AmazonFunction(driver, TaskInfo)
     TaskInfo['ordernumber'] = ''
     Task.FunctionInfo.update(TaskInfo['shippingaddress'])
     Task.NewRandomAccount = False
     Task.speed = randint(50, 100)
     EmailDomain = '@foxairmail.com'
     if not Task.CreatAcount(EmailDomain):
         return False
     time.sleep(5)
     Task.FunctionInfo.update(TaskInfo['billingaddress'])
     SubRetry = 0
     while not Task.AddCreditCard():
         SubRetry += 1
         if SubRetry > self.SubMaxRetry:
             print('Credit Card add fail for: ' + TaskInfo['username'])
             return False
     Task.FunctionInfo.update(TaskInfo['shippingaddress'])
     SubRetry = 0
     while not Task.SetAddress():
         SubRetry += 1
         if SubRetry > self.SubMaxRetry:
             print(traceback.print_exc())
             return False
     Viewpages = AmazonPages(driver)
     for i in range(randint(2,6)):
         Viewpages.RandomClick()
         Viewpages.WalkAround(ScrollSpeed=[5,20])
         time.sleep(randint(5,15))
     TaskInfo['cookies'] = json.dumps(driver.get_cookies())
     return True
Esempio n. 3
0
 def SubTask(self, driver, TaskInfo):
     driver.implicitly_wait(5)
     Task = AmazonFunction(driver, TaskInfo)
     TaskInfo['ordernumber'] = ''
     Task.FunctionInfo.update(TaskInfo['shippingaddress'])
     Task.NewRandomAccount = False
     Task.speed = randint(50, 100)
     EmailDomain = '@foxairmail.com'
     if not Task.login():
         return False
     time.sleep(5)
     Task.FunctionInfo.update(TaskInfo['billingaddress'])
     Viewpages = AmazonPages(driver)
     for i in range(randint(2, 6)):
         Viewpages.RandomClick()
         Viewpages.WalkAround(ScrollSpeed=[5, 20])
         time.sleep(randint(5, 15))
     TaskInfo['cookies'] = json.dumps(driver.get_cookies())
     TaskInfo['logindate'] = datetime()
     db = amazon_db()
     db.open()
     db.accountinfo_update_item(
         TaskInfo['username'],
         TaskInfo['password'],
         TaskInfo['cookies'],
         TaskInfo['createdate'],
         TaskInfo['logindate'],
         TaskInfo['lastbuy'],
         TaskInfo['in_use'],
         TaskInfo['alive'],
         TaskInfo['MAC'],
     )
     db.close()
     del db
     return True
Esempio n. 4
0
 def SubTask(self, driver, TaskInfo):
     driver.implicitly_wait(5)
     Task = AmazonFunction(driver, TaskInfo)
     TaskInfo['ordernumber'] = ''
     Task.FunctionInfo.update(TaskInfo['shippingaddress'])
     Task.NewRandomAccount = False
     Task.speed = randint(50, 100)
     EmailDomain = '@foxairmail.com'
     if not Task.CreatAcount(EmailDomain):
         return False
     time.sleep(5)
     Task.FunctionInfo.update(TaskInfo['billingaddress'])
     SubRetry = 0
     while not Task.AddCreditCard():
         SubRetry += 1
         if SubRetry > self.SubMaxRetry:
             print('Credit Card add fail for: ' + TaskInfo['username'])
             return False
     Task.FunctionInfo.update(TaskInfo['shippingaddress'])
     SubRetry = 0
     while not Task.SetAddress():
         SubRetry += 1
         if SubRetry > self.SubMaxRetry:
             print(traceback.print_exc())
             return False
     SearchTask = AmazonPages(driver)
     for asin in TaskInfo['asins']:
         Task.FunctionInfo['asin'] = asin
         Task.FunctionInfo.update(
             ProductFrame.loc[Task.FunctionInfo['asin']].to_dict())
         Task.FunctionInfo['lowprice'] = str(
             round((float(Task.FunctionInfo['buyboxprice']) - 0.03), 2))
         Task.FunctionInfo['highprice'] = str(
             round((float(Task.FunctionInfo['buyboxprice']) + 0.02), 2))
         #Task.FunctionInfo['lowprice'] = Task.FunctionInfo['buyboxprice']
         #Task.FunctionInfo['highprice'] = Task.FunctionInfo['buyboxprice']
         SubRetry = 0
         while not SearchTask.SearchAndView(TaskInfo):
             SubRetry += 1
             if SubRetry > self.SubMaxRetry:
                 print('Search production fail...')
                 # Fatal error if not found in any page  TBD
                 TaskInfo['errorcode'] = 'SearchFail'
                 TaskInfo['status'] = False
                 return False
         SubRetry = 0
         while not Task.AddCart():
             SubRetry += 1
             if SubRetry > self.SubMaxRetry:
                 print('Add cart fail...')
                 # Fatal error if not found TBD
                 return False
     SubRetry = 0
     while not Task.PlaceOrder():
         SubRetry += 1
         if SubRetry > self.SubMaxRetry:
             return False
     TaskInfo['cookies'] = json.dumps(driver.get_cookies())
     return True
Esempio n. 5
0
 def SubTask(self, driver, TaskInfo):
     driver.implicitly_wait(10)
     Task = AmazonFunction(driver, TaskInfo)
     TaskInfo['ordernumber'] = ''
     Task.speed = randint(80, 160)
     if not Task.login():
         return False
     time.sleep(5)
     if TaskInfo['retrynumber'] == 0:
         SubRetry = 0
         while not Task.CleanCart():
             SubRetry += 1
             if SubRetry > self.SubMaxRetry:
                 return False
     SubRetry = 0
     while not Task.SetAddress():
         SubRetry += 1
         if SubRetry > self.SubMaxRetry:
             return False
     SearchTask = AmazonPages(driver)
     SearchTask.SortOutTask(TaskInfo)
     for asin in TaskInfo['asins']:
         Task.FunctionInfo['asin'] = asin
         Task.FunctionInfo.update(
             ProductFrame.loc[Task.FunctionInfo['asin']].to_dict())
         Task.FunctionInfo['lowprice'] = str(
             round((float(Task.FunctionInfo['buyboxprice']) - 0.05), 2))
         Task.FunctionInfo['highprice'] = str(
             round((float(Task.FunctionInfo['buyboxprice']) + 0.05), 2))
         #Task.FunctionInfo['lowprice'] = Task.FunctionInfo['buyboxprice']
         #Task.FunctionInfo['highprice'] = Task.FunctionInfo['buyboxprice']
         SubRetry = 0
         while not SearchTask.SearchAndView(TaskInfo):
             SubRetry += 1
             if SubRetry > self.SubMaxRetry:
                 print('Search production fail...')
                 # Fatal error if not found in any page  TBD
                 TaskInfo['errorcode'] = 'SearchFail'
                 TaskInfo['status'] = False
                 return False
         SubRetry = 0
         while not Task.AddCart():
             SubRetry += 1
             if SubRetry > self.SubMaxRetry:
                 print('Add cart fail...')
                 # Fatal error if not found TBD
                 return False
     SubRetry = 0
     while not Task.PlaceOrder():
         SubRetry += 1
         if SubRetry > self.SubMaxRetry:
             return False
     TaskInfo['cookies'] = json.dumps(driver.get_cookies())
     return True
Esempio n. 6
0
 def SubTask(self, driver, TaskInfo):
     driver.implicitly_wait(5)
     Task = AmazonFunction(driver, TaskInfo)
     TaskInfo['ordernumber'] = ''
     Task.FunctionInfo.update(TaskInfo['shippingaddress'])
     Task.NewRandomAccount = False
     Task.speed = randint(50, 100)
     EmailDomain = '@foxairmail.com'
     if not Task.login():
         return False
     time.sleep(5)
     Task.FunctionInfo.update(TaskInfo['billingaddress'])
     Viewpages = AmazonPages(driver)
     for i in range(randint(2, 6)):
         Viewpages.RandomClick()
         Viewpages.WalkAround(ScrollSpeed=[5, 20])
         time.sleep(randint(5, 15))
     TaskInfo['cookies'] = json.dumps(driver.get_cookies())
     return True
Esempio n. 7
0
 def SubTask(self, driver, TaskInfo):
     driver.get("https://www.amazon.com/")
     time.sleep(10)
     Task = AmazonFunction(driver, TaskInfo)
     Task.speed = randint(120, 160)
     Task.FunctionInfo['lowprice'] = str(
         round((float(Task.FunctionInfo['buyboxprice']) - 0.01), 2))
     Task.FunctionInfo['highprice'] = str(
         round((float(Task.FunctionInfo['buyboxprice']) + 0.01), 2))
     SearchTask = AmazonPages(driver)
     #if not Task.SearchProduct():
     if not SearchTask.SearchAndView(TaskInfo):
         print('Search production fail...')
         # Fatal error if not found in any page  TBD
         TaskInfo['errorcode'] = 'SearchFail'
         TaskInfo['status'] = False
         return False
     if not Task.AddCart():
         print('Add cart fail...')
         return False
     return True
Esempio n. 8
0
    def SubTask(self, driver, TaskInfo):
        TaskInfo['lowprice'] = '0'
        TaskInfo['highprice'] = '0'
        self.TaskName = TaskInfo['asin']
        self.start_time = datetime.now()
        TaskInfo['keyword'] = random.sample(TaskInfo['keywords'], 1)[0]
        print('start info:::' + TaskInfo['asin'] + ' keyword: ' +
              TaskInfo['keyword'])
        Task = AmazonFunction(driver, TaskInfo)

        try:
            Task.driver.get('https://www.amazon.com/')
        except:
            pass
        try:
            Task.driver.maximize_window()
        except:
            print('Set full screen fail!')

        ProductionUrl = Task.SearchProduct()
        if not ProductionUrl:
            return False
        if not Task.ViewAllPage():
            return False
        if not Task.view_reviewer():
            return False
        if not Task.add_to_cart():
            return False
        Task.back_to_page(ProductionUrl)

        while Task.stay_time() < Task.min_view_time:
            Task.speed = randint(20, 60)
            if not Task.view_all():
                return False
            Task.back_to_page(ProductionUrl)

        self.TaskLog(TaskInfo)
        if int(TaskInfo['sections']) != '0':
            self.PushRetryQueue(TaskInfo)
            TaskInfo['sections'] = str(int(TaskInfo['sections']) - 1)