Commit 03a9ceb6 authored by lixiaofang's avatar lixiaofang

try except

parent e4a4dc41
This diff is collapsed.
...@@ -114,7 +114,7 @@ def get_data(numtime): ...@@ -114,7 +114,7 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306) db="alpha", port=3306)
cursor = db.cursor() 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,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall() data = cursor.fetchall()
user_id = list(data) user_id = list(data)
logging.info("Database version : %s " % user_id) logging.info("Database version : %s " % user_id)
......
...@@ -199,27 +199,25 @@ if __name__ == "__main__": ...@@ -199,27 +199,25 @@ if __name__ == "__main__":
# time.sleep(random.randint(2000,2500)) # time.sleep(random.randint(2000,2500))
else: numtime = time_conv(1)
numtime = time_conv(1) user_id = get_commnet_id(numtime)
user_id = get_data(numtime) for j in user_id:
for j in user_id:
id = int(j[0]) id = int(j[0])
follow_num = random.randint(0,1) follow_num = random.randint(0,1)
# time.sleep(random.randint(500, 1500)) # time.sleep(random.randint(500, 1500))
for i in range(follow_num): for i in range(follow_num):
cookies = logins() cookies = logins()
follow(cookies, id) follow(cookies, id)
# time.sleep(random.randint(2000, 3000)) # time.sleep(random.randint(2000, 3000))
except: except:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
......
time_list = [1, 11]
for i in range(len(time_list)):
if time_list[i] != 11:
print(time_list[i])
\ 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