Exemplo n.º 1
0
 def SubTask(self, driver, TaskInfo):
     SelectCard = self.PopCard()
     if SelectCard:
         TaskInfo.update(SelectCard)
         Task = AmazonFunction(driver, TaskInfo)
         if not Task.login():
             self.PushCard(SelectCard)
             print('Login fail...')
             return False
         if Task.AddCreditCard():
             print('Credit Card added for: ' + TaskInfo['username'])
         else:
             self.PushCard(SelectCard)
             print('Credit Card add fail for: ' + TaskInfo['username'])
     else:
         TaskInfo.update({
             'nameoncard': '',
             'ccnumber': '',
             'ccmonth': '',
             'ccyear': '',
             'cardstatus': '',
             'checkaccount': ''
         })
         TaskInfo['status'] = False
         TaskInfo['errorcode'] = 'InsufficientCard'
         print('Credit Card is insufficient for: ' + TaskInfo['username'])
     time.sleep(5)
     Task.FunctionInfo['cookies'] = json.dumps(driver.get_cookies())
Exemplo 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
Exemplo 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.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