Ejemplo n.º 1
0
 def SubTask(self, driver, TaskInfo):
     TaskInfo['asin'] = ''
     TaskInfo['reviewerid'] = ''
     TaskInfo['reviewstar'] = ''
     TaskInfo['reviewertitle'] = ''
     TaskInfo['reviewercontent'] = ''
     TaskInfo['reviewerusername'] = TaskInfo['username']
     Task = AmazonFunction(driver, TaskInfo)
     if not Task.login():
         self.PushRetryQueue(TaskInfo)
         self.TaskLog(TaskInfo)
         return False
     if not Task.GoToReview():
         self.PushRetryQueue(TaskInfo)
         self.TaskLog(TaskInfo)
         return False
     TaskInfoCopy = TaskInfo['asins'].copy()
     for asin in TaskInfoCopy:
         TaskInfo.update({'asin': asin})
         SelectReviewer = self.PopReviewer(asin)
         TaskInfo.update(SelectReviewer)
         if SelectReviewer['reviewercontent']:
             if Task.WriteReview():
                 print('Reviewer added for: ' + TaskInfo['username'] +
                       ' :: ' + asin)
                 TaskInfo['asins'].remove(asin)
             else:
                 self.PushReviewer(SelectReviewer)
                 print('Reviewer fail for: ' + TaskInfo['username'] +
                       ' :: ' + asin)
         else:
             TaskInfo['status'] = False
             TaskInfo['errorcode'] = 'InsufficientReviewer'
             print('Reviewer is insufficient for: ' + TaskInfo['username'] +
                   ' :: ' + asin)
             TaskInfo['asins'].remove(asin)
         self.TaskLog(TaskInfo)
     # not all ASIN done
     if TaskInfo['asins']:
         self.PushRetryQueue(TaskInfo)
     pass
Ejemplo n.º 2
0
 def SubTask(self, driver, TaskInfo):
     driver.implicitly_wait(5)
     TaskInfo['Logout'] = True
     TaskInfo['cookies'] = AccountFrame.loc[TaskInfo['username']]['cookies']
     while TaskInfo['username'] in self.submitedUser:
         time.sleep(30)
         print('Reviewer waits for: ' + TaskInfo['username'] + ' :: ' +
               TaskInfo['asin'])
     print('Reviewer begins for: ' + TaskInfo['username'] + ' :: ' +
           TaskInfo['asin'])
     self.submitedUser.append(TaskInfo['username'])
     Task = AmazonFunction(driver, TaskInfo)
     if not Task.login():
         self.TaskLog(TaskInfo)
         return False
     if not Task.GoToReview():
         self.TaskLog(TaskInfo)
         return False
     if Task.WriteReview():
         print('Reviewer added for: ' + TaskInfo['username'] + ' :: ' +
               TaskInfo['asin'])
     else:
         print('Reviewer fail for: ' + TaskInfo['username'] + ' :: ' +
               TaskInfo['asin'])
Ejemplo n.º 3
0
 def SubTask(self, driver, TaskInfo):
     driver.implicitly_wait(10)
     TaskInfo['Logout'] = True
     if TaskInfo['username'] in self.submitedUser:
         TaskInfo['Logout'] = False
         while TaskInfo['username'] in self.submitedUser:
             time.sleep(30)
             print('Reviewer waits for: ' + TaskInfo['username'] + ' :: ' + TaskInfo['asin'])
             TaskInfo['status'] = False
             TaskInfo['errorcode'] = 'WaitToLogin'
         TaskInfo['retrynumber'] -= 1
         return
     print('Reviewer begins for: ' + TaskInfo['username'] + ' :: ' + TaskInfo['asin'])
     self.submitedUser.append(TaskInfo['username'])
     Task = AmazonFunction(driver, TaskInfo)
     if not Task.login():
         return False
     TaskInfo['cookies'] = json.dumps(driver.get_cookies())
     if not Task.GoToReview():
         return False
     if Task.WriteReview():
         print('Reviewer added for: ' + TaskInfo['username'] + ' :: ' + TaskInfo['asin'])
     else:
         print('Reviewer fail for: ' + TaskInfo['username'] + ' :: ' + TaskInfo['asin'])