Commit a78a48b1 authored by lixiaofang's avatar lixiaofang

change daima

parent ccdd1f2f
......@@ -24,5 +24,29 @@
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
</code_scheme>
</component>
\ No newline at end of file
This diff is collapsed.
......@@ -13,31 +13,24 @@ auto_reply_url = "http://earth.iyanzhi.com/api/v1/reply/create"
auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
def get_majia():
try:
data = open("batch_user_gen")
list=[]
data = open("/srv/apps/cybertron/batch_user_gen")
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
user_id=list[maj-1]
maj = random.randint(1, len(list))
user_id = list[maj - 1]
return user_id
except:
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -50,21 +43,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def login():
def login():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -73,8 +64,8 @@ def login():
return None
def click(cookies_get, id):
def click(cookies_get, id):
try:
post_dict = {
'type': 0,
......@@ -90,16 +81,16 @@ def click(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def reply(cookies_get,id,content):
def reply(cookies_get, id, content):
try:
post_dict={
'topic_id':id,
'content':content
post_dict = {
'topic_id': id,
'content': content
}
response=requests.post(url=auto_reply_url,
cookies=cookies_get,
data=post_dict)
response = requests.post(url=auto_reply_url,
cookies=cookies_get,
data=post_dict)
logging.info("response.text:%s" % response.text)
......@@ -107,6 +98,7 @@ def reply(cookies_get,id,content):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv():
try:
now = datetime.datetime.now()
......@@ -117,12 +109,15 @@ def time_conv():
except:
return None
def get_topic_id(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work', passwd='oars152!traipseize738',
db = pymysql.connect(host="172.17.40.144", user='work', passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT id FROM topic WHERE is_online =1 and create_time >= %s" ,(numtime))
cursor.execute(
"SELECT id,user_id FROM topic WHERE is_online =1 and create_time >= %s and user_id in (select user_id from user_extra where is_shadow = 0)",
(numtime))
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -132,16 +127,15 @@ def get_topic_id(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def get_comment():
try:
data = pd.read_csv("guanshui", sep='\n')
num = random.randint(0, len(data))
data = open("/srv/apps/cybertron/guanshui", "r")
list_guanshui = []
for i in data['comment scene']:
l = i.split('\t')
list_guanshui.append(l[0])
comment = list_guanshui[num-1]
for i in data:
list_guanshui.append(i)
num = random.randint(0, len(list_guanshui))
comment = list_guanshui[num - 1]
return comment
......@@ -149,41 +143,44 @@ def get_comment():
return None
if __name__ == "__main__":
try:
numtime=time_conv()
numtime = time_conv()
topic_id = get_topic_id(numtime)
click_num = random.randint(1, 3)
for j in topic_id:
id = int(j[0])
click_num = random.randint(1,5)
for i in range(click_num):
for i in range(click_num):
for j in topic_id:
id = int(j[0])
cookies = login()
time.sleep(random.randint(1, 10))
click(cookies, id)
time.sleep(300)
topic_id = get_topic_id(numtime)
for j in topic_id:
comment_num = random.randint(1, 3)
id = int(j[0])
for i in range(comment_num):
comment_num = random.randint(1, 3)
for j in topic_id:
for i in range(comment_num):
id = int(j[0])
cookies= login()
cookies = login()
if cookies is not None:
comment = get_comment()
time.sleep(random.randint(1, 10))
reply(cookies, id, comment)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -9,19 +9,19 @@ import logging
auto_click_url = "http://earth.iyanzhi.com/api/v1/like"
def get_majia():
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
maj = random.randint(1, len(list))
user_id=list[maj-1]
user_id = list[maj - 1]
return user_id
......@@ -29,10 +29,10 @@ def get_majia():
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -45,21 +45,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def login():
def login():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -68,8 +66,8 @@ def login():
return None
def click(cookies_get, id):
def click(cookies_get, id):
try:
post_dict = {
'type': 0,
......@@ -85,6 +83,7 @@ def click(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(numtime):
try:
now = datetime.datetime.now()
......@@ -94,13 +93,15 @@ def time_conv(numtime):
except:
return None
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute(
"SELECT distinct(user_id),id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -110,11 +111,12 @@ def get_data(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
time_list = [1,2,3,4,5,6,7]
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
......@@ -122,39 +124,33 @@ if __name__ == "__main__":
user_id = get_data(numtime)
dict = {}
dicts = {}
for i in user_id:
if i[0] not in dict.keys():
dict.setdefault(i[0], [])
dict[i[0]].append(i[1])
if i[0] not in dicts.keys():
dicts.setdefault(i[0], [])
dicts[i[0]].append(i[1])
else:
dict[i[0]].append(i[1])
dicts[i[0]].append(i[1])
print(dicts)
for key, value in dicts.items():
for key,value in dict.items():
rand_num = random.randint(0, len(value) - 1)
rand_num = random.randint(0,len(value)-1)
rand_id = value[rand_num]
rand_id = value[rand_num]
urge_num = random.randint(0, 1)
for i in range(urge_num):
# time.sleep(random.randint(10, 50))
time.sleep(random.randint(1, 10))
cook=login()
cook = login()
if cook is not None:
click(cook, rand_id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -4,23 +4,23 @@ import datetime
import pymysql
import random
import traceback
from log_settings import *
import logging
auto_click_url = "http://earth.iyanzhi.com/api/v1/like"
def get_majia():
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
maj = random.randint(1, len(list))
user_id=list[maj-1]
user_id = list[maj - 1]
return user_id
......@@ -28,10 +28,10 @@ def get_majia():
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -44,21 +44,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def logins():
def logins():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -67,8 +65,8 @@ def logins():
return None
def click(cookies_get, id):
def click(cookies_get, id):
try:
post_dict = {
'type': 0,
......@@ -84,6 +82,7 @@ def click(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(numtime):
try:
now = datetime.datetime.now()
......@@ -93,14 +92,16 @@ def time_conv(numtime):
except:
return None
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
print("---------")
cursor.execute("SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute(
"SELECT distinct(user_id),id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -110,15 +111,16 @@ def get_data(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
time_list = [1,2,3,4,5,6,7]
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
numtime = time_conv(7+3*i)
numtime = time_conv(7 + 3 * i)
user_id = get_data(numtime)
......@@ -135,23 +137,22 @@ if __name__ == "__main__":
else:
dict[i[0]].append(i[1])
for key,value in dict.items():
for key, value in dict.items():
rand_num = random.randint(0,len(value)-1)
rand_num = random.randint(0, len(value) - 1)
rand_id = value[rand_num]
rand_id = value[rand_num]
urge_num = random.randint(0, 1)
for i in range(urge_num):
time.sleep(random.randint(10, 50))
time.sleep(random.randint(1, 10))
cook=logins()
cook = logins()
if cook is not None:
click(cook, rand_id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -3,27 +3,24 @@ import time
import datetime
import pymysql
import random
import pandas as pd
import traceback
from log_settings import *
import logging
auto_reply_url = "http://earth.iyanzhi.com/api/v1/reply/create"
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen.txt")
list=[]
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
maj = random.randint(1, len(list))
user_id=list[maj-1]
user_id = list[maj - 1]
return user_id
......@@ -31,10 +28,10 @@ def get_majia():
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -47,21 +44,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def logins():
def logins():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -70,65 +65,67 @@ def logins():
return None
def reply(cookies_get,id,content):
try :
post_dict={
'topic_id':id,
'content':content
def reply(cookies_get, id, content):
try:
post_dict = {
'topic_id': id,
'content': content
}
response=requests.post(url=auto_reply_url,
cookies=cookies_get,
data=post_dict)
response = requests.post(url=auto_reply_url,
cookies=cookies_get,
data=post_dict)
logging.info("response.text :%s"%(response.text))
logging.info("response.text :%s" % (response.text))
except:
logging.error("catch exception,reply:%s" % traceback.format_exc())
def time_conv(numtime):
def time_conv(numtime):
try:
now = datetime.datetime.now()
yes_time = now -datetime.timedelta(days=numtime)
yes_time_str=yes_time.strftime('%Y-%m-%d')
yes_time = now - datetime.timedelta(days=numtime)
yes_time_str = yes_time.strftime('%Y-%m-%d')
return yes_time_str
except:
return None
def get_topic_id(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' " %numtime)
cursor.execute(
"SELECT distinct(user_id),id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0) " % numtime)
data = cursor.fetchall()
topic_id = list(data)
logging.info("Database version : %s "%topic_id)
logging.info("Database version : %s " % topic_id)
db.close()
return topic_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def get_comment():
data = open("/srv/apps/cybertron/guanshui")
data = pd.read_csv("guanshui", sep='\n')
num = random.randint(0, len(data))
list_guanshui = []
for i in data['comment scene']:
l = i.split('\t')
list_guanshui.append(l[0])
comment = list_guanshui[num-1]
for i in data:
list_guanshui.append(i)
num = random.randint(0, len(list_guanshui))
comment = list_guanshui[num - 1]
return comment
if __name__ == "__main__":
try:
time_list = [1,2,3,4,5,6,7]
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
......@@ -136,17 +133,34 @@ if __name__ == "__main__":
topic_id = get_topic_id(numtime)
dicts = {}
for i in topic_id:
time.sleep(random.randint(10, 50))
if i[0] not in dicts.keys():
cook = logins()
dicts.setdefault(i[0], [])
dicts[i[0]].append(i[1])
if cook is not None:
else:
dicts[i[0]].append(i[1])
print(dicts)
for key, value in dicts.items():
rand_num = random.randint(0, len(value) - 1)
rand_id = value[rand_num]
time.sleep(random.randint(1, 10))
cook = logins()
if cook is not None:
comment = get_comment()
reply(cook, i, comment)
reply(cook, rand_id, comment)
except:
......
......@@ -7,25 +7,23 @@ import traceback
from log_settings import *
import logging
auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
auto_pick_url = "http://earth.iyanzhi.com/api/v1/pick/do_pick"
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
maj = random.randint(1, len(list))
user_id=list[maj-1]
user_id = list[maj - 1]
return user_id
......@@ -33,10 +31,10 @@ def get_majia():
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -49,21 +47,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def logins():
def logins():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -72,8 +68,8 @@ def logins():
return None
def follow(cookies_get, id):
def follow(cookies_get, id):
try:
post_dict = {
'type': 1,
......@@ -89,8 +85,8 @@ def follow(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(numtime):
def time_conv(numtime):
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=numtime)
......@@ -99,16 +95,19 @@ def time_conv(numtime):
except:
return None
def get_topic_new_user(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT user_id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute(
"SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
topic_data = cursor.fetchall()
cursor.execute("SELECT user_id FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute(
"SELECT distinct(user_id) FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
new_user_data = cursor.fetchall()
topic_data = list(topic_data)
new_user_data = list(new_user_data)
......@@ -124,6 +123,7 @@ def get_topic_new_user(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
......@@ -131,29 +131,22 @@ if __name__ == "__main__":
user_id = get_topic_new_user(numtime)
for j in user_id:
follow_num = random.randint(1, 2)
id = int(j[0])
for i in range(follow_num):
follow_num = random.randint(1,2)
for j in user_id:
for i in range(follow_num):
id = int(j[0])
time.sleep(random.randint(10, 50))
time.sleep(random.randint(10, 30))
cookies=logins()
cookies = logins()
if cookies is not None:
follow(cookies, id)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -11,7 +11,7 @@ auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
......@@ -31,7 +31,7 @@ def get_majia():
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -95,11 +95,11 @@ def time_conv(numtime):
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -123,15 +123,15 @@ if __name__ == "__main__":
user_id = get_data(numtime)
for j in user_id:
follow_num = random.randint(1,2)
id = int(j[0])
for i in range(follow_num):
follow_num = random.randint(1,2)
for j in user_id:
for i in range(follow_num):
id = int(j[0])
time.sleep(random.randint(10, 50))
time.sleep(random.randint(1,10))
cookies=logins()
......@@ -139,6 +139,7 @@ if __name__ == "__main__":
follow(cookies, id)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......
......@@ -7,15 +7,15 @@ import pandas as pd
import traceback
from log_settings import *
import logging
auto_click_url = "http://earth.iyanzhi.com/api/v1/like"
auto_reply_url = "http://earth.iyanzhi.com/api/v1/reply/create"
auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -28,7 +28,6 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
......@@ -36,12 +35,10 @@ def get_cookies(user_id):
def logins(user_id):
try:
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -50,8 +47,8 @@ def logins(user_id):
return None
def follow(cookies_get, id):
def follow(cookies_get, id):
try:
post_dict = {
'type': 1,
......@@ -67,6 +64,7 @@ def follow(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv():
try:
now = datetime.datetime.now()
......@@ -75,15 +73,18 @@ def time_conv():
except:
return None
def get_follw_majia(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("select temp1.user_id,temp1.email,temp2.user_id from account_user_auth temp1 left join (select user_id,follow_id,create_time from user_follow) temp2 on temp1.user_id = temp2.follow_id where temp1.email in ('s_05tmwu@shadow.com','s_07CRHt@shadow.com','s_0bdxxU@shadow.com','s_0mfxcO@shadow.com','s_0u6eaV@shadow.com','s_0UudEr@shadow.com','s_1b3v5V@shadow.com','s_ZVuLyC@shadow.com','s_1dbAoA@shadow.com','s_1dholX@shadow.com','s_1EpLlt@shadow.com') and temp2.create_time like '%%%%%s%%%%' "%(numtime))
cursor.execute(
"select temp1.user_id,temp1.email,temp2.user_id from account_user_auth temp1 left join (select user_id,follow_id,create_time from user_follow) temp2 on temp1.user_id = temp2.follow_id where temp1.email in ('s_05tmwu@shadow.com','s_07CRHt@shadow.com','s_0bdxxU@shadow.com','s_0mfxcO@shadow.com','s_0u6eaV@shadow.com','s_0UudEr@shadow.com','s_1b3v5V@shadow.com','s_ZVuLyC@shadow.com','s_1dbAoA@shadow.com','s_1dholX@shadow.com','s_1EpLlt@shadow.com') and temp2.create_time like '%%%%%s%%%%' " % (
numtime))
data = cursor.fetchall()
data=list(data)
data = list(data)
logging.info("Database version : %s " % data)
db.close()
return data
......@@ -91,11 +92,12 @@ def get_follw_majia(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
numtime=time_conv()
numtime = time_conv()
# get majia zhanghao
......@@ -137,22 +139,10 @@ if __name__ == "__main__":
for i in value:
cookies=logins(id)
cookies = logins(id)
if cookies is not None:
follow(cookies,i)
follow(cookies, i)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -6,21 +6,22 @@ import random
import traceback
from log_settings import *
import logging
auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
def get_majia():
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
maj = random.randint(1, len(list))
user_id=list[maj-1]
user_id = list[maj - 1]
return user_id
......@@ -28,10 +29,10 @@ def get_majia():
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -44,21 +45,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def logins():
def logins():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -67,8 +66,8 @@ def logins():
return None
def follow(cookies_get, id):
def follow(cookies_get, id):
try:
post_dict = {
'type': 1,
......@@ -84,6 +83,7 @@ def follow(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(numtime):
try:
now = datetime.datetime.now()
......@@ -93,14 +93,15 @@ def time_conv(numtime):
except:
return None
def get_commnet_id(numtime):
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT user_id FROM reply WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT user_id FROM reply WHERE create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data_comment = cursor.fetchall()
......@@ -116,42 +117,40 @@ def get_commnet_id(numtime):
data_reply_reply = cursor.fetchall()
cursor.execute(
"SELECT user_id FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT user_id FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data_group_follow = cursor.fetchall()
cursor.execute(
"select user_id from account_user WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
"select user_id from account_user WHERE create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data_new_user = cursor.fetchall()
data_id = list(data_comment)
data1_id=list(data_reply_topic)
data2_id=list(data_group_follow)
data3_id=list(data_new_user)
data1_id = list(data_reply_topic)
data2_id = list(data_group_follow)
data3_id = list(data_new_user)
data_reply_reply = list(data_reply_reply)
user_id = []
for i in data_id:
if i[0] is not None:
if i[0] is not None:
user_id.append(i)
for i in data1_id:
if i[0] is not None:
if i[0] is not None:
user_id.append(i)
for i in data2_id:
if i[0] is not None:
if i[0] is not None:
user_id.append(i)
for i in data3_id:
if i[0] is not None:
if i[0] is not None:
user_id.append(i)
for i in data_reply_reply:
if i[0] is not None:
if i[0] is not None:
user_id.append(i)
logging.info("Database version : %s " % user_id)
......@@ -160,6 +159,7 @@ def get_commnet_id(numtime):
return user_id
if __name__ == "__main__":
try:
......@@ -181,27 +181,7 @@ if __name__ == "__main__":
cookies = logins()
if cookies is not None:
follow(cookies, id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -12,7 +12,7 @@ auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
......@@ -32,7 +32,7 @@ def get_majia():
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -95,9 +95,9 @@ def time_conv(numtime):
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',passwd='oars152!traipseize738',db="alpha", port=3306)
db = pymysql.connect(host="172.17.40.144", user='work',passwd='oars152!traipseize738',db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("select user_id from account_user_auth where user_id not in (select user_id from pv_maidian where page_name ='home' and partiton_date >= %s )" ,(numtime))
cursor.execute("select user_id from account_user_auth where user_id not in (select user_id from pv_maidian where page_name ='home' and partiton_date >= %s ) and user_id in (select user_id from user_extra where is_shadow = 0)" ,(numtime))
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -113,15 +113,15 @@ if __name__ == "__main__":
user_id = get_data(numtime)
for i in user_id:
urge_num = random.randint(1,2)
urge_num = random.randint(1,2)
for j in range(urge_num):
for j in range(urge_num):
for i in user_id:
cookies = index_first()
cookies = get_cookies(i)
time.sleep(random.randint(10, 50))
time.sleep(random.randint(1, 10))
cook=logins()
......@@ -129,7 +129,7 @@ if __name__ == "__main__":
follow(cook, i)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -137,9 +137,3 @@ if __name__ == "__main__":
......@@ -7,24 +7,21 @@ import traceback
from log_settings import *
import logging
auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
maj = random.randint(1, len(list))
user_id=list[maj-1]
user_id = list[maj - 1]
return user_id
......@@ -32,10 +29,10 @@ def get_majia():
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -48,21 +45,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def logins():
def logins():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -71,6 +66,7 @@ def logins():
return None
def follow(cookies_get, id):
try:
post_dict = {
......@@ -87,6 +83,7 @@ def follow(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(numtime):
try:
now = datetime.datetime.now()
......@@ -96,13 +93,15 @@ def time_conv(numtime):
except:
return None
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("select user_id from pv_maidian where page_name ='home' and partiton_date like '%%%%%s%%%%' " % numtime)
cursor.execute(
"select user_id from pv_maidian where page_name ='home' and partiton_date like '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -112,30 +111,24 @@ def get_data(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
numtime = time_conv(1)
user_id = get_data(numtime)
urge_num = random.randint(0, 1)
for j in range(urge_num):
for i in user_id:
for i in user_id:
id = int(i[0])
urge_num = random.randint(0, 1)
for i in range(urge_num):
id = int(i[0])
time.sleep(random.randint(10, 50))
time.sleep(random.randint(1, 10))
cook=logins()
cook = logins()
if cook is not None:
follow(cook,id)
follow(cook, id)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -11,19 +11,19 @@ auto_follow_url = "http://earth.iyanzhi.com/api/v1/follow"
auto_click_url = "http://earth.iyanzhi.com/api/v1/like"
def get_majia():
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
maj = random.randint(1, len(list))
user_id=list[maj-1]
user_id = list[maj - 1]
return user_id
......@@ -31,10 +31,10 @@ def get_majia():
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -47,21 +47,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def logins():
def logins():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -70,8 +68,8 @@ def logins():
return None
def click(cookies_get, id):
def click(cookies_get, id):
try:
post_dict = {
'type': 0,
......@@ -87,8 +85,8 @@ def click(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def follow(cookies_get, id):
def follow(cookies_get, id):
try:
post_dict = {
'type': 1,
......@@ -106,8 +104,8 @@ def follow(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(numtime):
def time_conv(numtime):
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=numtime)
......@@ -116,14 +114,15 @@ def time_conv(numtime):
except:
return None
def get_star_user_id(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT user_id FROM topic WHERE is_online=1 and content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT user_id FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -133,14 +132,15 @@ def get_star_user_id(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def get_star_topic_id(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT id FROM topic WHERE is_online=1 and content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT id FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -150,11 +150,11 @@ def get_star_topic_id(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
if __name__ == "__main__":
try:
time_list = [1,2,3,4,5,6,7]
time_list = [1, 2, 3, 4, 5, 6, 7]
for i in time_list:
......@@ -162,33 +162,32 @@ if __name__ == "__main__":
user_id = get_star_topic_id(numtime)
for j in user_id:
id = int(j[0])
urge_num = random.randint(0, 1)
urge_num = random.randint(0, 1)
for i in range(urge_num):
for j in user_id:
for i in range(urge_num):
id = int(j[0])
time.sleep(random.randint(10, 50))
time.sleep(random.randint(1, 10))
cookies = logins()
if cookies is not None:
click(cookies, id)
time.sleep(300)
user_id = get_star_user_id(numtime)
urge_num = random.randint(1, 2)
for j in user_id:
for i in range(urge_num):
id = int(j[0])
user_id = get_star_user_id(numtime)
urge_num = random.randint(1, 2)
for j in user_id:
for i in range(urge_num):
id = int(j[0])
time.sleep(random.randint(10, 50))
time.sleep(random.randint(1, 10))
cookies = logins()
......@@ -197,5 +196,3 @@ if __name__ == "__main__":
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -12,7 +12,7 @@ auto_urge_url = "http://earth.iyanzhi.com/api/v1/user/urge"
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
......@@ -33,7 +33,7 @@ def get_majia():
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -52,6 +52,7 @@ def get_cookies(user_id):
return None
def logins():
try:
......@@ -98,12 +99,12 @@ def time_conv(numtime):
def get_star_useid(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT user_id FROM topic WHERE is_online=1 and content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT user_id FROM topic WHERE is_online=1 and (content_level =4 or content_level =5) and create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -141,4 +142,4 @@ if __name__ == "__main__":
Urge(cookies, id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -12,7 +12,7 @@ auto_urge_url = "http://earth.iyanzhi.com/api/v1/user/urge"
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
......@@ -32,7 +32,7 @@ def get_majia():
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -51,6 +51,7 @@ def get_cookies(user_id):
return None
def logins():
try:
......@@ -94,41 +95,25 @@ def time_conv(numtime):
except:
return None
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
db.close()
return user_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def get_star_useid(numtime):
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT user_id FROM topic WHERE is_online=1 and content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' and user_id in (select user_id from user_extra where is_shadow = 0)" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
db.close()
return user_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
......@@ -140,15 +125,15 @@ if __name__ == "__main__":
user_id = get_data(numtime)
for j in user_id:
urge_num = random.randint(0, 2)
id = int(j[0])
for i in range(urge_num):
urge_num = random.randint(0, 2)
for j in user_id:
for i in range(urge_num):
id = int(j[0])
time.sleep(random.randint(10, 50))
time.sleep(random.randint(3, 10))
cookies=logins()
......@@ -156,26 +141,6 @@ if __name__ == "__main__":
Urge(cookies, id)
for i in time_list:
numtime = time_conv(i)
user_id = get_star_useid(numtime)
for j in user_id:
id = int(j[0])
for i in range(1):
time.sleep(random.randint(10, 50))
cookies = logins()
if cookies is not None:
Urge(cookies, id)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -9,19 +9,19 @@ import logging
auto_urge_url = "http://earth.iyanzhi.com/api/v1/user/urge"
def get_majia():
def get_majia():
try:
data = open("batch_user_gen")
data = open("/srv/apps/cybertron/batch_user_gen")
list=[]
list = []
for i in data:
list.append(i.strip('\n').strip(','))
maj = random.randint(1,len(list))
maj = random.randint(1, len(list))
user_id=list[maj-1]
user_id = list[maj - 1]
return user_id
......@@ -29,10 +29,10 @@ def get_majia():
logging.error("catch exception,get_majia:%s" % traceback.format_exc())
return None
def get_cookies(user_id):
def get_cookies(user_id):
try:
with open("user_session.txt", 'r') as f:
with open("/srv/apps/cybertron/user_session.txt", 'r') as f:
try:
data = f.readlines()
except:
......@@ -45,21 +45,19 @@ def get_cookies(user_id):
for i in list:
if user_id == i[0]:
return (i[1])
except:
return None
def logins():
def logins():
try:
user_id=get_majia()
user_id = get_majia()
cookies = get_cookies(user_id)
if cookies is not None:
return {'sessionid': cookies}
except:
......@@ -68,8 +66,8 @@ def logins():
return None
def Urge(cookies_get, id):
def Urge(cookies_get, id):
try:
post_dict = {
'id': id
......@@ -84,6 +82,7 @@ def Urge(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(numtime):
try:
now = datetime.datetime.now()
......@@ -93,13 +92,16 @@ def time_conv(numtime):
except:
return None
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2zej7rzxnj036zxt3.mysql.rds.aliyuncs.com", user='work',
db = pymysql.connect(host="172.17.40.144", user='work',
passwd='oars152!traipseize738',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("select user_id from account_user_auth where user_id not in (select user_id from pv_maidian where page_name ='home' and partiton_date >= %s) ", (numtime))
cursor.execute(
"select user_id from account_user_auth where user_id not in (select user_id from pv_maidian where page_name ='home' and partiton_date >= %s) and user_id in (select user_id from user_extra where is_shadow = 0)",
(numtime))
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -109,6 +111,7 @@ def get_data(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
......@@ -116,29 +119,18 @@ if __name__ == "__main__":
user_id = get_data(numtime)
for i in user_id:
for j in range(2):
urge_num = random.randint(1, 2)
for j in range(urge_num):
for i in user_id:
time.sleep(random.randint(1, 15))
cook = logins()
if cook is not None:
Urge(cook, i)
time.sleep(300)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
This diff is collapsed.
import requests
import time
import datetime
import pymysql
import random
import traceback
# from log_settings import *
import logging
import json
login_url = "http://earth.iyanzhi.com/api/account/login_pwd"
def index_first():
try:
r1 = requests.get(login_url)
......@@ -22,56 +17,40 @@ def index_first():
def get_cook():
data = open("batch_user_gen")
list=[]
dict={}
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
}
post_dict = {
'account_type': 2,
'pwd': '123456',
'email': i
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
headers=response.headers
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)
dict[i] = cook
return dict
dicts[i] = cook
dict=get_cook()
return dicts
with open("user_session.txt" ,'w') as f:
for key,value in dict.items():
dicts = get_cook()
with open("user_session.txt", 'w') as f:
for key, value in dicts.items():
f.write(key)
f.write(",")
f.write(value)
f.write("\n")
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