Commit 918fac34 authored by lixiaofang's avatar lixiaofang

add

parent 0db1078a
......@@ -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.fix import fix_no_comment_click
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):
......@@ -120,6 +121,10 @@ class Command(BaseCommand):
reply_comment3.reply_comment3()
# 获得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():
return None
data = get_data()
print(data)
file = open("/srv/apps/physical/vest/data/user_id.txt", "w")
def auto_user_id():
try:
data = get_data()
print(data)
file = open("/srv/apps/physical/vest/data/user_id.txt", "w")
if data:
for i in data:
file.write(str(i[0]))
file.write("\n")
if data:
for i in data:
file.write(str(i[0]))
file.write("\n")
except:
logging.error("index_first:%s" % traceback.format_exc())
......@@ -17,40 +17,51 @@ def index_first():
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 = {
'account_type': 2,
'pwd': '123456',
'email': i
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
headers = response.headers
print(response.text)
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
logging.info("response.text :%s" % response.text)
dicts[i] = cook
return dicts
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")
try:
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 = {
'account_type': 2,
'pwd': '123456',
'email': i
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
headers = response.headers
print(response.text)
cook = headers['Set-Cookie'].split(";")
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())
return None
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