Commit 6571cc7b authored by lixiaofang's avatar lixiaofang

update

parent 180a7809
This diff is collapsed.
......@@ -228,13 +228,10 @@ if __name__ == "__main__":
for i in range(click_num):
# time.sleep(random.randint(500, 1500))
cookies = login()
click(cookies, id)
# time.sleep(random.randint(500, 1500))
topic_id = get_topic_id(numtime)
for j in topic_id:
......@@ -245,8 +242,6 @@ if __name__ == "__main__":
for i in range(comment_num):
# time.sleep(random.randint(500, 1500))
cookies= login()
if cookies is not None:
......
......@@ -161,6 +161,8 @@ if __name__ == "__main__":
for i in range(urge_num):
time.sleep(random.randint(10, 50))
cook=login()
if cook is not None:
......
......@@ -130,8 +130,6 @@ if __name__ == "__main__":
for i in time_list:
#time.sleep(random.randint(3000,4500))
numtime = time_conv(7+3*i)
user_id = get_data(numtime)
......@@ -157,6 +155,8 @@ if __name__ == "__main__":
for i in range(urge_num):
time.sleep(random.randint(10, 50))
cook=logins()
if cook is not None:
......
......@@ -145,14 +145,14 @@ if __name__ == "__main__":
for i in time_list:
#time.sleep(random.randint(500,1500))
numtime = time_conv(i)
topic_id = get_topic_id(numtime)
for i in topic_id:
time.sleep(random.randint(10, 50))
cook = logins()
if cook is not None:
......
......@@ -149,7 +149,7 @@ if __name__ == "__main__":
for i in range(follow_num):
# time.sleep(random.randint(500, 1500))
time.sleep(random.randint(10, 50))
cookies=logins()
......
......@@ -144,7 +144,7 @@ if __name__ == "__main__":
for i in range(follow_num):
# time.sleep(random.randint(500, 1500))
time.sleep(random.randint(10, 50))
cookies=logins()
......@@ -152,10 +152,6 @@ if __name__ == "__main__":
follow(cookies, id)
# time.sleep(random.randint(2000,2500))
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......
......@@ -167,6 +167,8 @@ if __name__ == "__main__":
for i in value:
time.sleep(random.randint(10, 50))
cookies=logins(id)
if cookies is not None:
......
......@@ -188,18 +188,16 @@ if __name__ == "__main__":
follow_num = random.randint(0, 1)
# time.sleep(random.randint(500, 1500))
for i in range(follow_num):
time.sleep(random.randint(10, 50))
cookies = logins()
if cookies is not None:
follow(cookies, id)
# time.sleep(random.randint(2000, 3000))
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......
......@@ -111,7 +111,7 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
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 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_num='home' and partiton_date >= %s )" ,(numtime))
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -123,9 +123,6 @@ def get_data(numtime):
if __name__ == "__main__":
try:
#time.sleep(random.randint(3000,4500))
numtime = time_conv(3)
user_id = get_data(numtime)
......@@ -138,6 +135,8 @@ if __name__ == "__main__":
cookies = index_first()
time.sleep(random.randint(10, 50))
cook=logins()
if cook is not None:
......
......@@ -6,12 +6,8 @@ import random
import traceback
from log_settings import *
import logging
auto_click_url = "http://earth.igengmei.com/api/v1/like"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
auto_pick_url = "http://earth.igengmei.com/api/v1/pick/do_pick"
auto_follow_url = "http://earth.igengmei.com/api/v1/follow"
def index_first():
......@@ -101,24 +97,6 @@ def follow(cookies_get, id):
logging.error("catch exception,logins:%s" % traceback.format_exc())
def pick(cookies_get,id):
try:
post_dict = {
'pick_user_id': id,
'is_pick': 1,
'pick_type': 0
}
response = requests.post(url=auto_pick_url,
cookies=cookies_get,
data=post_dict)
logging.info("response.text:%s" % response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
def time_conv(numtime):
try:
now = datetime.datetime.now()
......@@ -133,7 +111,7 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
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 user_id from pv_maidian where page_num='home' and partiton_date like '%%%%%s%%%%' " % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % data)
......@@ -160,12 +138,12 @@ if __name__ == "__main__":
for i in range(urge_num):
# time.sleep(random.randint(10, 50))
cook=logins()
if cook is not None:
pick(cook, id)
follow(cook,id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......
import requests
import time
import datetime
import pymysql
import random
import traceback
from log_settings import *
import logging
auto_pick_url = "http://earth.igengmei.com/api/v1/pick/do_pick"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
def index_first():
try:
r1 = requests.get(login_url)
return r1.cookies.get_dict()
except:
logging.error("index_first:%s" % traceback.format_exc())
return None
def get_majia():
try:
data = open("batch user gen")
list=[]
for i in data:
list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500))
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 login():
try:
# time.sleep(random.randint(300, 500))
user_id=get_majia()
cookies = index_first()
post_dict={
'account_type':2,
'pwd':'123456',
'email':user_id
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
logging.info("response.text :%s" % response.text)
return {'sessionid': cook}
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
return None
def logins(id):
try:
cookies = index_first()
post_dict={
'account_type':2,
'pwd':'123456',
'email':id
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
logging.info("response.text :%s" % response.text)
cok ={'sessionid': cook}
if cok is not None:
return cok
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
return None
def pick(cookies_get,id):
try:
post_dict = {
'pick_user_id': id,
'is_pick': 1,
'pick_type': 0
}
response = requests.post(url=auto_pick_url,
cookies=cookies_get,
data=post_dict)
logging.info("response.text:%s" % response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
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')
return yes_time_str
except:
return None
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT distinct(user_id) FROM topic WHERE 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_new_user_id(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"select user_id from account_user WHERE is_online =1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data_new_user = cursor.fetchall()
data = list(data_new_user)
logging.info("Database version : %s " % data)
db.close()
return user_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def get_star_useid(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT user_id FROM topic WHERE 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)
db.close()
return user_id
except:
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]
#topic
for i in range(len(time_list)):
numtime = time_conv(time_list[i])
user_id = get_data(numtime)
for j in user_id:
id = int(j[0])
# time.sleep(random.randint(200,500))
pick_num = random.randint(1, 2)
for i in range(pick_num):
cookies=login()
if cookies is not None:
pick(cookies, id)
# time.sleep(random.randint(500, 1000))
#star
for i in range(len(time_list)):
numtime = time_conv(time_list[i])
user_id = get_star_useid(numtime)
for j in user_id:
id = int(j[0])
# time.sleep(random.randint(200,500))
pick_num=random.randint(1,5)
for i in range(pick_num):
cookies = login()
if cookies is not None:
pick(cookies, id)
# time.sleep(random.randint(500, 1000))
for i in range(len(time_list)):
if time_list[i] == 1:
numtime = time_conv(time_list[i])
topic_user_id = get_data(numtime)
new_user_id=get_new_user_id(numtime)
for i in new_user_id:
for j in topic_user_id:
if i == j :
pick_num = random.randint(0,1)
for x in range(pick_num):
cookies = logins(id)
if cookies is not None:
pick(cookies, i)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
import requests
import time
import datetime
import pymysql
import random
import traceback
from log_settings import *
import logging
auto_urge_url = "http://earth.igengmei.com/api/v1/user/urge"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
def index_first():
try:
r1 = requests.get(login_url)
return r1.cookies.get_dict()
except:
logging.error("index_first:%s" % traceback.format_exc())
return None
def get_majia():
try:
data = open("batch user gen")
list=[]
for i in data:
list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500))
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 logins():
try:
# time.sleep(random.randint(300, 500))
user_id=get_majia()
cookies = index_first()
post_dict={
'account_type':2,
'pwd':'123456',
'email':user_id
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
logging.info("response.text :%s" % response.text)
if cook is not None:
return {'sessionid': cook}
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
return None
def Urge(cookies_get, id):
try:
post_dict = {
'id': id
}
response = requests.post(url=auto_urge_url,
cookies=cookies_get,
data=post_dict)
logging.info("response.text:%s" % response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
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')
return yes_time_str
except:
return None
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT user_id,id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % data)
db.close()
return user_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
# time.sleep(random.randint(3000,4500))
numtime = time_conv(3)
user_id = get_data(numtime)
for i in user_id:
urge_num = random.randint(1, 2)
for i in range(urge_num):
cookies = index_first()
cook = logins()
if cook is not None:
Urge(cook, id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
import requests
import time
import datetime
import pymysql
import random
import traceback
from log_settings import *
import logging
auto_pick_url = "http://earth.igengmei.com/api/v1/pick/do_pick"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
def index_first():
try:
r1 = requests.get(login_url)
return r1.cookies.get_dict()
except:
logging.error("index_first:%s" % traceback.format_exc())
return None
def get_majia():
try:
data = open("batch user gen")
list=[]
for i in data:
list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500))
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 login():
try:
# time.sleep(random.randint(300, 500))
user_id=get_majia()
cookies = index_first()
post_dict={
'account_type':2,
'pwd':'123456',
'email':user_id
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
logging.info("response.text :%s" % response.text)
if cook is not None:
return {'sessionid': cook}
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
return None
def logins(id):
try:
cookies = index_first()
post_dict={
'account_type':2,
'pwd':'123456',
'email':id
}
response = requests.post(
url=login_url,
data=post_dict,
cookies=cookies
)
headers=response.headers
cook = headers['Set-Cookie'].split(";")
cook = cook[0].split('=')[1]
logging.info("response.text :%s" % response.text)
if cook is not None:
return {'sessionid': cook}
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
return None
def pick(cookies_get,id):
try:
post_dict = {
'pick_user_id': id,
'is_pick': 1,
'pick_type': 0
}
response = requests.post(url=auto_pick_url,
cookies=cookies_get,
data=post_dict)
logging.info("response.text:%s" % response.text)
except:
logging.error("catch exception,logins:%s" % traceback.format_exc())
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')
return yes_time_str
except:
return None
def get_data(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT distinct(user_id) FROM topic WHERE 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_new_user_id(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"select user_id from account_user WHERE is_online =1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data_new_user = cursor.fetchall()
data = list(data_new_user)
logging.info("Database version : %s " % data)
db.close()
return user_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def get_star_useid(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
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)
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:
time_list = [1,2,3,4,5,6,7]
#star
for i in range(len(time_list)):
numtime = time_conv(time_list[i])
user_id = get_star_useid(numtime)
for j in user_id:
id = int(j[0])
# time.sleep(random.randint(200,500))
pick_num=random.randint(1,5)
for i in range(pick_num):
cookies = login()
if cookies is not None:
pick(cookies, id)
# time.sleep(random.randint(500, 1000))
for i in range(len(time_list)):
if time_list[i] == 1:
numtime = time_conv(time_list[i])
topic_user_id = get_data(numtime)
new_user_id=get_new_user_id(numtime)
for i in new_user_id:
for j in topic_user_id:
if i == j :
pick_num = random.randint(0,1)
for x in range(pick_num):
cookies = logins(id)
if cookies is not None:
pick(cookies, i)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -178,39 +178,35 @@ if __name__ == "__main__":
id = int(j[0])
# time.sleep(random.randint(200,500))
urge_num = random.randint(0, 1)
for i in range(urge_num):
time.sleep(random.randint(10, 50))
cookies = logins()
if cookies is not None:
click(cookies, id)
# time.sleep(random.randint(500, 1000))
user_id = get_star_user_id(numtime)
for j in user_id:
id = int(j[0])
# time.sleep(random.randint(200,500))
urge_num = random.randint(1, 2)
for i in range(urge_num):
time.sleep(random.randint(10, 50))
cookies = logins()
if cookies is not None:
follow(cookies, id)
# time.sleep(random.randint(500, 1000))
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......
......@@ -141,10 +141,10 @@ if __name__ == "__main__":
id = int(j[0])
# time.sleep(random.randint(200,500))
for i in range(1):
time.sleep(random.randint(10, 50))
cookies = logins()
if cookies is not None:
......
......@@ -46,8 +46,6 @@ def get_majia():
def logins():
try:
# time.sleep(random.randint(300, 500))
user_id=get_majia()
cookies = index_first()
......@@ -155,20 +153,18 @@ if __name__ == "__main__":
id = int(j[0])
# time.sleep(random.randint(200,500))
urge_num = random.randint(0, 2)
for i in range(urge_num):
time.sleep(random.randint(10, 50))
cookies=logins()
if cookies is not None:
Urge(cookies, id)
# time.sleep(random.randint(500, 1000))
for i in time_list:
......@@ -180,17 +176,15 @@ if __name__ == "__main__":
id = int(j[0])
# time.sleep(random.randint(200,500))
for i in range(1):
time.sleep(random.randint(10, 50))
cookies = logins()
if cookies is not None:
Urge(cookies, id)
# time.sleep(random.randint(500, 1000))
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
\ No newline at end of file
......@@ -31,8 +31,6 @@ def get_majia():
for i in data:
list.append(i.strip('\n').strip(','))
# time.sleep(random.randint(0, 500))
maj = random.randint(1,len(list))
user_id=list[maj-1]
......@@ -99,7 +97,7 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
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 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_num='home' and partiton_date >= %s) ", (numtime))
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -112,8 +110,6 @@ def get_data(numtime):
if __name__ == "__main__":
try:
# time.sleep(random.randint(3000,4500))
numtime = time_conv(3)
user_id = get_data(numtime)
......@@ -124,6 +120,8 @@ if __name__ == "__main__":
for j in range(urge_num):
time.sleep(random.randint(10, 50))
cook = logins()
if cook is not None:
......
# import requests
# import time
# import datetime
# import pymysql
# import random
# import traceback
# # from log_settings import *
# import logging
# auto_pick_url = "http://172.30.8.42:9001/api/v1/pick/do_pick"
#
# login_url = "http://earth.igengmei.com/api/account/login_pwd"
#
# def index_first():
# try:
# r1 = requests.get(login_url)
# return r1.cookies.get_dict()
# except:
#
# logging.error("index_first:%s" % traceback.format_exc())
#
# return None
#
# def get_majia():
#
# try:
# data = open("batch user gen")
#
# list=[]
#
# for i in data:
# list.append(i.strip('\n').strip(','))
#
# # time.sleep(random.randint(0, 500))
#
# 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 login():
#
# try:
#
# # time.sleep(random.randint(300, 500))
#
# user_id=get_majia()
#
# cookies = index_first()
#
# post_dict={
# 'account_type':2,
# 'pwd':'123456',
# 'email':user_id
# }
# response = requests.post(
# url=login_url,
# data=post_dict,
# cookies=cookies
# )
#
# headers=response.headers
#
# cook = headers['Set-Cookie'].split(";")
#
# cook = cook[0].split('=')[1]
#
# if cook is not None:
#
# logging.info("response.text :%s" % response.text)
#
# print({'sessionid': cook})
#
# return {'sessionid': cook}
#
# except:
#
# logging.error("catch exception,logins:%s" % traceback.format_exc())
#
# return None
#
# def logins(id):
#
# try:
#
# cookies = index_first()
#
# post_dict={
# 'account_type':2,
# 'pwd':'123456',
# 'email':id
# }
# response = requests.post(
# url=login_url,
# data=post_dict,
# cookies=cookies
# )
#
# headers=response.headers
#
# cook = headers['Set-Cookie'].split(";")
#
# cook = cook[0].split('=')[1]
#
# logging.info("response.text :%s" % response.text)
#
#
#
# cok ={'sessionid': cook}
#
# print(cok)
#
# if cok is not None:
#
# return cok
#
# except:
#
# logging.error("catch exception,logins:%s" % traceback.format_exc())
#
# return None
#
# def pick(cookies_get,id):
#
# try:
# post_dict = {
# 'pick_user_id': id,
# 'is_pick': 1,
# 'pick_type': 0
# }
# response = requests.post(url=auto_pick_url,
# cookies=cookies_get,
# data=post_dict)
# print(response.text)
# logging.info("response.text:%s" % response.text)
#
# except:
#
# logging.error("catch exception,logins:%s" % traceback.format_exc())
# print(traceback.format_exc())
#
# 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')
# return yes_time_str
# except:
# return None
#
# def get_data(numtime):
#
# try:
# db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
# cursor = db.cursor()
# cursor.execute("SELECT distinct(id) FROM picktopic WHERE 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_new_user_id(numtime):
# try:
# db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
# db="alpha", port=3306)
# cursor = db.cursor()
# cursor.execute(
# "select user_id from account_user WHERE is_online =1 and create_time LIKE '%%%%%s%%%%'" % numtime)
# data_new_user = cursor.fetchall()
# data = list(data_new_user)
# logging.info("Database version : %s " % data)
# db.close()
# return user_id
# except:
# logging.error("catch exception,get_data:%s" % traceback.format_exc())
# return None
#
# def get_star_useid(numtime):
#
# try:
#
# db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
# db="alpha", port=3306)
# cursor = db.cursor()
# cursor.execute(
# "SELECT user_id FROM topic WHERE 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)
# db.close()
# return user_id
# except:
# 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]
#
# #topic
#
# for i in range(len(time_list)):
#
# numtime = time_conv(time_list[i])
#
# # user_id = get_data(numtime)
#
# user_id=[1,2,3]
#
# for j in user_id:
#
#
# # time.sleep(random.randint(200,500))
#
# pick_num = random.randint(1, 2)
#
# for i in range(pick_num):
#
# cookies=login()
#
# if cookies is not None:
#
# pick(cookies, j)
#
# # time.sleep(random.randint(500, 1000))
#
# except:
# logging.error("catch exception,main:%s" % traceback.format_exc())
#
#
#
#
#
import datetime
numtime=3
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=numtime)
print(yes_time)
\ No newline at end of file
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