Commit 172f3cf4 authored by lixiaofang's avatar lixiaofang

majia new

parent b0c66013
This diff is collapsed.
......@@ -17,22 +17,34 @@ def index_first():
return r1.cookies.get_dict()
def login():
def get_majia():
num_majia = random.randint(1, 300)
data = open("batch user gen")
list=[]
for i in data:
list.append(i.strip('\n').strip(','))
cookies = index_first()
# user_id=majia[num]
# time.sleep(random.randint(0, 500))
user = 's_PzFznI@shadow.com'
pwd = '123456'
maj = random.randint(1, 300)
user_id=list[maj]
return user_id
def login():
user_id=get_majia()
cookies = index_first()
post_dict={
'account_type':2,
'pwd':pwd,
'email':user
'pwd':'123456',
'email':user_id
}
response = requests.post(
url=login_url,
......@@ -48,6 +60,8 @@ def login():
print(response.text, 'url')
print(cook)
return {'sessionid': cook}
def logins(id):
......@@ -127,6 +141,7 @@ def get_topic_id(numtime):
print("Database version : %s " % user_id)
db.close()
return user_id
def get_comment():
......
......@@ -20,24 +20,34 @@ def index_first():
return r1.cookies.get_dict()
def login(cookies,user,pwd):
def get_majia():
data = open("batch user gen")
list=[]
for i in data:
list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500))
# time.sleep(random.randint(300, 500))
maj = random.randint(1, 300)
# user_id=majia[maj]
user_id=list[maj]
return user_id
user = 's_PzFznI@shadow.com'
def login():
pwd = '123456'
user_id=get_majia()
cookies = index_first()
post_dict={
'account_type':2,
'pwd':pwd,
'email':user
'pwd':'123456',
'email':user_id
}
response = requests.post(
url=login_url,
......
......@@ -20,7 +20,7 @@ def index_first():
return r1.cookies.get_dict()
def login(cookies,user,pwd):
def login():
# time.sleep(random.randint(300, 500))
......
......@@ -91,7 +91,7 @@ def get_topic_new_user(numtime):
cursor.execute("SELECT user_id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
topic_data = cursor.fetchall()
cursor.execute("SELECT user_id FROM group_follow WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT user_id FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
new_user_data = cursor.fetchall()
topic_data = list(topic_data)
......@@ -165,6 +165,3 @@ if __name__ == "__main__":
# 1.当天发帖:[1-2]个粉丝
# 0.当日加组的用户:[1-2」个粉丝
# 0.当天:[1-10]个pick
\ No newline at end of file
......@@ -71,7 +71,7 @@ def get_data(numtime):
cursor = db.cursor()
print("---------")
cursor.execute("SELECT user_id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT distinct(user_id) FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
......
......@@ -77,7 +77,7 @@ def get_data(numtime):
print("---------")
cursor.execute("SELECT user_id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" %numtime)
cursor.execute("SELECT distinct(user_id) FROM topic WHERE create_time LIKE '%%%%%s%%%%'" %numtime)
data = cursor.fetchall()
......
......@@ -22,24 +22,34 @@ def index_first():
return r1.cookies.get_dict()
def login(cookies,user,pwd):
def get_majia():
data = open("batch user gen")
list=[]
for i in data:
list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500))
# time.sleep(random.randint(300, 500))
maj = random.randint(1, 300)
# user_id=majia[maj]
user_id=list[maj]
return user_id
user = 's_PzFznI@shadow.com'
def login():
pwd = '123456'
user_id=get_majia()
cookies = index_first()
post_dict={
'account_type':2,
'pwd':pwd,
'email':user
'pwd':'123456',
'email':user_id
}
response = requests.post(
url=login_url,
......
......@@ -71,7 +71,7 @@ def get_data(numtime):
cursor = db.cursor()
print("---------")
cursor.execute("SELECT user_id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT distinct(user_id) FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
......
This diff is collapsed.
......@@ -35,17 +35,19 @@
# else:
# dict[i[1]].append(i[0])
import random
import time
list={"key":[259, 300, 304, 307, 316, 318]}
for key,value in list.items():
us =get_majia()
rand_num = random.randint(0, len(value) - 1)
rand_id = value[rand_num]
print(us)
print(rand_id)
......
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