Commit a4153154 authored by lixiaofang's avatar lixiaofang

cookies

parent aa127655
This diff is collapsed.
......@@ -100,24 +100,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:
......@@ -152,24 +134,6 @@ def get_topic_new_user(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def get_topic_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 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()
db.close()
return user_id
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
if __name__ == "__main__":
try:
......@@ -193,24 +157,6 @@ if __name__ == "__main__":
follow(cookies, id)
user_id = get_topic_data(numtime)
for j in user_id:
id = int(j[0])
follow_num = random.randint(1,10)
for i in range(follow_num):
# time.sleep(random.randint(500, 1500))
cookies = logins()
if cookies is not None:
pick(cookies, id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......
......@@ -122,55 +122,6 @@ def get_data(numtime):
logging.error("catch exception,get_data:%s" % traceback.format_exc())
return None
def get_commnet_id(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 reply WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_comment = cursor.fetchall()
cursor.execute(
"SELECT replied_id FROM reply WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_reply = cursor.fetchall()
cursor.execute(
"SELECT user_id FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_group_follow = cursor.fetchall()
cursor.execute(
"select user_id from account_user WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_new_user = cursor.fetchall()
data_id = list(data_comment)
data1_id=list(data_reply)
data2_id=list(data_group_follow)
data3_id=list(data_new_user)
user_id = []
for i in data_id:
user_id.append(i)
for i in data1_id:
user_id.append(i)
for i in data2_id:
user_id.append(i)
for i in data3_id:
user_id.append(i)
print("Database version : %s " % user_id)
db.close()
return user_id
if __name__ == "__main__":
try:
......
......@@ -101,7 +101,7 @@ def follow(cookies_get, id):
def time_conv():
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=15)
yes_time = now - datetime.timedelta(minutes=15)
return yes_time
except:
return None
......
......@@ -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,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%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'"%(numtime))
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -144,6 +144,8 @@ if __name__ == "__main__":
follow(cook, id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......
......@@ -7,7 +7,7 @@ import traceback
from log_settings import *
import logging
auto_pick_url = "http://earth.igengmei.com/api/v1/pick/do_pick"
auto_urge_url = "http://earth.igengmei.com/api/v1/user/urge"
login_url = "http://earth.igengmei.com/api/account/login_pwd"
......@@ -69,20 +69,16 @@ def logins():
logging.error("catch exception,logins:%s" % traceback.format_exc())
return None
def pick(cookies_get,id):
def Urge(cookies_get, id):
try:
post_dict = {
'pick_user_id': id,
'is_pick': 1,
'pick_type': 0
'id': id
}
response = requests.post(url=auto_pick_url,
response = requests.post(url=auto_urge_url,
cookies=cookies_get,
data=post_dict)
print(response.text, 'url')
logging.info("response.text:%s" % response.text)
except:
......@@ -103,10 +99,10 @@ 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 create_time LIKE '%%%%%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'"%(numtime))
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % data)
logging.info("Database version : %s " % user_id)
db.close()
return user_id
except:
......@@ -132,7 +128,7 @@ if __name__ == "__main__":
if cook is not None:
pick(cook, id)
Urge(cook, id)
except:
logging.error("catch exception,main:%s" % traceback.format_exc())
......
This diff is collapsed.
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