Commit fdcf5e31 authored by lixiaofang's avatar lixiaofang

ad

parent 81ffe9b3
......@@ -104,7 +104,11 @@ def get_cookies(user_id):
try:
session_key = "majia_login_session"
data = redis_client.hget(session_key, user_id)
return data
logging.info("get data:%s" % data)
logging.info("get data:%s" % json.loads(data))
return json.loads(data)
except:
return None
......
......@@ -22,10 +22,7 @@ def get_data():
data = cursor.fetchall()
user_id = list(data)
if len(user_id):
print(user_id)
user_id_list.append(user_id[0])
else:
pass
pc.close()
return user_id_list
except:
......
import requests
import traceback
import logging
import json
from libs.cache import redis_client
login_url = "http://earth.iyanzhi.com/api/account/login_pwd"
......@@ -11,9 +12,7 @@ def index_first():
r1 = requests.get(login_url)
return r1.cookies.get_dict()
except:
logging.error("index_first:%s" % traceback.format_exc())
return None
......@@ -22,10 +21,8 @@ def get_cook():
data = open("/srv/apps/physical/vest/data/vest_user_email.txt")
list = []
dicts = {}
for i in data:
list.append(i.strip('\n').strip(','))
for i in list:
cookies = index_first()
post_dict = {
......@@ -44,9 +41,7 @@ def get_cook():
cook = cook[0].split('=')[1]
logging.info("response.text :%s" % response.text)
dicts[i] = cook
return dicts
except:
logging.error("index_first:%s" % traceback.format_exc())
......@@ -59,7 +54,7 @@ def get_session():
session_key = "majia_login_session"
dicts = get_cook()
for key, value in dicts.items():
redis_client.hset(session_key, key, value)
redis_client.hset(session_key, key,json.dumps(value))
except:
logging.error("index_first:%s" % traceback.format_exc())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment