def SubTask(self, driver, TaskInfo): SelectAddress = self.PopAddress() if SelectAddress: TaskInfo.update(SelectAddress) Task = AmazonFunction(driver, TaskInfo) if not Task.login(): self.PushAddress(SelectAddress) print('Login fail...') return False if Task.SetAddress(): print('Shipping address added for: ' + TaskInfo['username']) else: self.PushAddress(SelectAddress) print('Shipping address add fail for: ' + TaskInfo['username']) else: TaskInfo.update({ 'fullname': '', 'address': '', 'postalcode': '', 'city': '', 'state': '', 'phonenumber': '', 'addressstatus': '' }) TaskInfo['status'] = False TaskInfo['errorcode'] = 'InsufficientAddress' print('Address is insufficient for: ' + TaskInfo['username']) time.sleep(5)
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
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())
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
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
def SubTask(self, driver, TaskInfo): Task = AmazonFunction(driver, TaskInfo) Task.VerifyEnhance = True if Task.login(): try: driver.get("https://www.amazon.com/") time.sleep(5) except: pass if self.WalkaroundEn: Task.Walkaround() TaskInfo['cookies'] = json.dumps(driver.get_cookies()) else: TaskInfo['cookies'] = '' pass
def SubTask(self, driver, TaskInfo): TaskInfo['newcookies'] = '' TaskInfo['newemail'] = '' TaskInfo['newepassword'] = '' Task = AmazonFunction(driver, TaskInfo) if not Task.login(): print('Login fail...') return False if not Task.SecurityPage(): return False EmailDomain = '@foxairmail.com' if not Task.ChangeEmail(EmailDomain): return False if not Task.ChangePassword(): return False #TaskInfo['newemail'] = TaskInfo['username'] TaskInfo['newcookies'] = json.dumps(driver.get_cookies())
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
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
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'])
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'])
def SubTask(self, driver, TaskInfo): Task = AmazonFunction(driver, TaskInfo) TaskInfo['ordernumber'] = '' if not Task.login(): return False Task.PlaceOrder()