Commit 918fac34 authored by lixiaofang's avatar lixiaofang

add

parent 0db1078a
...@@ -13,6 +13,7 @@ from vest.follow import auto_follow, auto_follow_new ...@@ -13,6 +13,7 @@ from vest.follow import auto_follow, auto_follow_new
from vest.urge import auto_star_urge, auto_lunch_app, auto_lunch_app2, auto_urge1, auto_urge2 from vest.urge import auto_star_urge, auto_lunch_app, auto_lunch_app2, auto_urge1, auto_urge2
from vest.fix import fix_no_comment_click from vest.fix import fix_no_comment_click
from vest.reply_answer import reply_comment2, reply_comment3, answer_reply2, answer_reply3, answer_reply1 from vest.reply_answer import reply_comment2, reply_comment3, answer_reply2, answer_reply3, answer_reply1
from vest.request import get_session, auto_request, auto_user_id
class Command(BaseCommand): class Command(BaseCommand):
...@@ -120,6 +121,10 @@ class Command(BaseCommand): ...@@ -120,6 +121,10 @@ class Command(BaseCommand):
reply_comment3.reply_comment3() reply_comment3.reply_comment3()
# 获得session和use_id # 获得session和use_id
if options["mvest"] == "get_login_session":
get_session.get_session()
if options["mvest"] == "get_user_id":
auto_user_id.auto_user_id()
......
...@@ -31,11 +31,15 @@ def get_data(): ...@@ -31,11 +31,15 @@ def get_data():
return None return None
data = get_data() def auto_user_id():
print(data) try:
file = open("/srv/apps/physical/vest/data/user_id.txt", "w") data = get_data()
print(data)
file = open("/srv/apps/physical/vest/data/user_id.txt", "w")
if data: if data:
for i in data: for i in data:
file.write(str(i[0])) file.write(str(i[0]))
file.write("\n") file.write("\n")
except:
logging.error("index_first:%s" % traceback.format_exc())
...@@ -17,40 +17,51 @@ def index_first(): ...@@ -17,40 +17,51 @@ def index_first():
def get_cook(): def get_cook():
data = open("/srv/apps/physical/vest/data/vest_user_email.txt") try:
list = [] data = open("/srv/apps/physical/vest/data/vest_user_email.txt")
dicts = {} list = []
dicts = {}
for i in data:
list.append(i.strip('\n').strip(',')) for i in data:
list.append(i.strip('\n').strip(','))
for i in list:
cookies = index_first() for i in list:
post_dict = { cookies = index_first()
'account_type': 2, post_dict = {
'pwd': '123456', 'account_type': 2,
'email': i 'pwd': '123456',
} 'email': i
response = requests.post( }
url=login_url, response = requests.post(
data=post_dict, url=login_url,
cookies=cookies data=post_dict,
) cookies=cookies
headers = response.headers )
print(response.text) headers = response.headers
cook = headers['Set-Cookie'].split(";") print(response.text)
cook = cook[0].split('=')[1] cook = headers['Set-Cookie'].split(";")
logging.info("response.text :%s" % response.text) cook = cook[0].split('=')[1]
dicts[i] = cook logging.info("response.text :%s" % response.text)
dicts[i] = cook
return dicts
return dicts
dicts = get_cook() except:
with open("/srv/apps/physical/vest/data/user_session.txt", 'w') as f: logging.error("index_first:%s" % traceback.format_exc())
for key, value in dicts.items():
f.write(key) return None
f.write(",")
f.write(value)
f.write("\n") def get_session():
try:
dicts = get_cook()
with open("/srv/apps/physical/vest/data/user_session.txt", 'w') as f:
for key, value in dicts.items():
f.write(key)
f.write(",")
f.write(value)
f.write("\n")
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