Commit 0a15553d authored by 吴升宇's avatar 吴升宇

fix setting and 解析response

parent b86d6452
......@@ -42,9 +42,10 @@ def batch_handle(topic_id_list):
response = reply_answer(cookies, topic_id, comment1)
response = json.loads(response)
cookies = login()
reply_id = response["data"]["id"]
time = get_rand_time()
reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=time)
reply_id = response["data"].get('id')
if reply_id:
time = get_rand_time()
reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=time)
......
......@@ -41,9 +41,10 @@ def batch_handle(topic_id_list):
response = reply_answer(cookies, topic_id, comment1)
response = json.loads(response)
cookies = login()
reply_id = response["data"]["id"]
time = get_rand_time(hourup=0)
reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=time)
reply_id = response["data"].get('id')
if reply_id:
time = get_rand_time(hourup=0)
reply2.apply_async(args=(cookies, topic_id, comment2, reply_id), eta=time)
except:
logging_exception()
......
......@@ -122,7 +122,7 @@ def click(cookies_get, id):
return
else:
click_cache.set(click_key, 1)
click_cache.expire(click_key, settings.cache_seconds)
click_cache.expire(click_key, settings.CACHE_SECONDS)
# 点赞
try:
......@@ -164,7 +164,7 @@ def reply(cookies_get, id, content):
return
else:
reply_cache.set(reply_key, 1)
reply_cache.expire(reply_key, settings.cache_seconds)
reply_cache.expire(reply_key, settings.CACHE_SECONDS)
try:
post_dict = {
'topic_id': id,
......@@ -295,7 +295,7 @@ def follow(cookies_get, id):
return
else:
follow_cache.set(follow_key, 1)
follow_cache.expire(follow_key, settings.cache_seconds)
follow_cache.expire(follow_key, settings.CACHE_SECONDS)
try:
post_dict = {
'type': 1,
......@@ -468,7 +468,7 @@ def reply2(cookies_get, id, content, replied_id):
return
else:
reply_cache.set(reply_key, 1)
reply_cache.expire(reply_key, settings.cache_seconds)
reply_cache.expire(reply_key, settings.CACHE_SECONDS)
try:
post_dict = {
'topic_id': id,
......@@ -496,7 +496,7 @@ def pictorial_reply(cookies_get, id, content):
return
else:
reply_cache.set(reply_key, 1)
reply_cache.expire(reply_key, settings.cache_seconds)
reply_cache.expire(reply_key, settings.CACHE_SECONDS)
try:
post_dict = {
'pictorial_id': 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