def get_session(q): session = None try: session = login_info.get_session()['session'] if session is None: # todo: 邮件通知 time.sleep(60 * 5) session = login_info.get_session()['session'] except (sse, rsle, rpuese): # 预防因为网络问题导致的登陆不成功 print('本次登陆出现问题') time.sleep(60) session = login_info.get_session()['session'] finally: q.put(session)
def get_session(d): while True: d['session'] = None try: d['session'] = login_info.get_session()['session'] if d['session'] is None: # todo: 邮件通知 time.sleep(60 * 5) d['session'] = login_info.get_session()['session'] except (sse, rsle, rpuese): # 预防因为网络问题导致的登陆不成功 print('本次登陆出现问题,sleep 60s') time.sleep(60) d['session'] = login_info.get_session()['session'] else: time.sleep(60 * 60 * 10)
def get_session(d): while True: d['session'] = None try: d['session'] = login_info.get_session()['session'] if d['session'] is None: # todo: 邮件通知 time.sleep(60*5) d['session'] = login_info.get_session()['session'] except (sse, rsle, rpuese): # 预防因为网络问题导致的登陆不成功 print('本次登陆出现问题,sleep 60s') time.sleep(60) d['session'] = login_info.get_session()['session'] else: time.sleep(60*60*10)
def store_cookie(): cookie_dict = login_info.get_session()['cookie'] r = redis.Redis(host='localhost', port=6379, db=0) cookiestr = json.dumps(cookie_dict) r.set('userinfo_cookie', cookiestr)