def fastMode(): flag = 1 while (1): try: if flag == 1: validate_cookies() getUsername() select_all_cart_item() remove_item() # 检测配置文件修改 if int(time.time()) - configTime >= 600: nowMd5 = getconfigMd5() if not nowMd5 == configMd5: logger.info('配置文件修改,重新读取文件') getconfig() # modelType logger.info('第' + str(flag) + '次 ') flag += 1 # 检测库存 inStockSkuid = check_stock(checksession, skuids, area) # 下单任务 fastModeAutoBuy(inStockSkuid) # 休眠模块 timesleep = random.randint(1, 3) / 10 time.sleep(timesleep) # 校验是否还在登录模块 if flag % 100 == 0: logger.info('校验是否还在登录') validate_cookies() except Exception as e: print(traceback.format_exc()) time.sleep(10)
def check_Config(): global configMd5, configTime nowMd5 = getconfigMd5() configTime = time.time() if not nowMd5 == configMd5: logger.info('配置文件修改,重新读取文件') getconfig() configMd5 = nowMd5
def fastMode(): flag = 1 while (1): try: if flag == 1: message.sendAny("【京东口罩监控服务已开启】") validate_cookies() getUsername() select_all_cart_item() remove_item() # 检测配置文件修改 if int(time.time()) - configTime >= 600: nowMd5 = getconfigMd5() if not nowMd5 == configMd5: #logger.info('配置文件修改,重新读取文件') getconfig() # modelType if flag <= 50: print('第' + str(flag) + '次') flag += 1 # 检测库存 inStockSkuid = check_new(session, skuids, area) # 下单任务 fastModeAutoBuy(inStockSkuid) # 休眠模块 timesleep = random.randint(8, 12) / 10 time.sleep(timesleep) # 校验是否还在登录模块 if flag % 100 == 0: #logger.info('第' + str(flag) + '次') logger.info('校验是否还在登录,第' + str(flag) + '次') validate_cookies() if flag % 1000 == 0: message.sendAny('V2 ALIVE') if order_count >= 10: os.system('setsid python jdBuyMask_for_VPS.py &') sys.exit(1) except Exception as e: print(traceback.format_exc()) time.sleep(10)
logger.error('请在configDemo.ini文件中输入你的商品id') sys.exit(1) ''' 备用 ''' # eid eid = global_config.getRaw('Temporary', 'eid') fp = global_config.getRaw('Temporary', 'fp') # 支付密码 payment_pwd = global_config.getRaw('config', 'payment_pwd') # 初次 configTime = int(time.time()) getconfig() configMd5 = getconfigMd5() message = message(messageType=messageType, sc_key=sc_key, mail=mail) is_Submit_captcha = False submit_captcha_rid = '' submit_captcha_text = '' encryptClientInfo = '' submit_Time = 0 session = requests.session() session.headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/531.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3", "Connection": "keep-alive" }