Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
7e45a44a
Commit
7e45a44a
authored
Oct 15, 2019
by
吴升宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add auto reply
parent
dacc6546
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
333 additions
and
23 deletions
+333
-23
crontab.py
crontab.py
+20
-16
trans2es_mapping2es.py
trans2es/management/commands/trans2es_mapping2es.py
+11
-1
auto_click_per_1d_by_post.py
vest/click/auto_click_per_1d_by_post.py
+2
-2
auto_click_per_2h_by_post.py
vest/click/auto_click_per_2h_by_post.py
+2
-2
auto_reply_per_1d_to_pictorial.py
vest/reply/auto_reply_per_1d_to_pictorial.py
+96
-0
auto_reply_per_1d_to_topic.py
vest/reply/auto_reply_per_1d_to_topic.py
+87
-0
auto_reply_per_2h_to_topic.py
vest/reply/auto_reply_per_2h_to_topic.py
+59
-0
auto_request.py
vest/request/auto_request.py
+0
-1
get_session.py
vest/request/get_session.py
+25
-0
test.py
vest/test.py
+31
-1
No files found.
crontab.py
View file @
7e45a44a
...
@@ -19,7 +19,8 @@ ontime_list = [
...
@@ -19,7 +19,8 @@ ontime_list = [
"1 */2 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_2h_by_post_and_regist"
,
"1 */2 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_2h_by_post_and_regist"
,
"0 9 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m get_login_session"
,
"0 9 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m get_login_session"
,
"0 0 * * 3 source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m get_user_id"
,
"0 0 * * 3 source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m get_user_id"
,
"0 14,18,22 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m principal_online_comment1"
# "0 14,18,22 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m principal_online_comment1",
"25 */2 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_reply_per_2h_to_topic"
]
]
...
@@ -27,21 +28,24 @@ random_time_list = [
...
@@ -27,21 +28,24 @@ random_time_list = [
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_click_per_1d_by_post"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_click_per_1d_by_post"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_1d_by_regist"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_1d_by_regist"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_1d_by_post"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_1d_by_post"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply1"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_reply_per_1d_to_pictorial"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply2"
,
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_reply_per_1d_to_topic"
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply3"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply1",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply5"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply2",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply7"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply3",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m yesterday_topic_reply"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply5",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m before_yesterday_topic_reply"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply7",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m three_days_ago_topic_reply"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m yesterday_topic_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m five_days_ago_topic_reply"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m before_yesterday_topic_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m seven_days_ago_reply"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m three_days_ago_topic_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment1"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m five_days_ago_topic_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment3"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m seven_days_ago_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment2"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment1",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment5"
,
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment3",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment7"
]
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment2",
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment5",
# "* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment7"
]
...
...
trans2es/management/commands/trans2es_mapping2es.py
View file @
7e45a44a
...
@@ -7,7 +7,8 @@ import traceback
...
@@ -7,7 +7,8 @@ import traceback
import
logging
import
logging
from
libs.es
import
ESPerform
from
libs.es
import
ESPerform
from
trans2es.type_info
import
get_type_info_map
,
TypeInfo
from
trans2es.type_info
import
get_type_info_map
,
TypeInfo
from
vest.reply
import
true_comment_one
,
true_comment_two
,
true_comment_three
,
one_seven_topic_comment
from
vest.reply
import
true_comment_one
,
true_comment_two
,
true_comment_three
,
one_seven_topic_comment
,
\
auto_reply_per_1d_to_pictorial
,
auto_reply_per_1d_to_topic
,
auto_reply_per_2h_to_topic
from
vest.click
import
true_click_five
,
true_click_two
,
true_click_four
,
true_click_one
,
true_click_three
,
\
from
vest.click
import
true_click_five
,
true_click_two
,
true_click_four
,
true_click_one
,
true_click_three
,
\
one_seven_star_topic
,
auto_click_per_1d_by_post
,
auto_click_per_2h_by_post
one_seven_star_topic
,
auto_click_per_1d_by_post
,
auto_click_per_2h_by_post
from
vest.follow
import
auto_follow
,
auto_follow_new
,
auto_follow_per_5m_by_followed
,
\
from
vest.follow
import
auto_follow
,
auto_follow_new
,
auto_follow_per_5m_by_followed
,
\
...
@@ -142,6 +143,15 @@ class Command(BaseCommand):
...
@@ -142,6 +143,15 @@ class Command(BaseCommand):
if
options
[
"mvest"
]
==
"vest_click_reply"
:
if
options
[
"mvest"
]
==
"vest_click_reply"
:
vest_click_reply
.
vest_click_reply
()
vest_click_reply
.
vest_click_reply
()
# 自动评论
if
options
[
"mvest"
]
==
"auto_reply_per_1d_to_pictorial"
:
auto_reply_per_1d_to_pictorial
.
auto_reply_per_1d_to_pictorial
()
if
options
[
"mvest"
]
==
"auto_reply_per_2h_to_topic"
:
auto_reply_per_2h_to_topic
.
auto_reply_per_2h_to_topic
()
if
options
[
"mvest"
]
==
"auto_reply_per_1d_to_topic"
:
auto_reply_per_1d_to_topic
.
auto_reply_per_1d_to_topic
()
# 榜单评论
# 榜单评论
if
options
[
"mvest"
]
==
"principal_offline_comment1"
:
if
options
[
"mvest"
]
==
"principal_offline_comment1"
:
principal_offline_comment1
.
principal_offline_comment1
()
principal_offline_comment1
.
principal_offline_comment1
()
...
...
vest/click/auto_click_per_1d_by_post.py
View file @
7e45a44a
...
@@ -17,10 +17,10 @@ def get_commnet_id(numtime, numtime2, content_level_low=0, content_level_top=6):
...
@@ -17,10 +17,10 @@ def get_commnet_id(numtime, numtime2, content_level_low=0, content_level_top=6):
cursor
.
execute
(
cursor
.
execute
(
"select t.id from topic t left join user_extra u on t.user_id = u.user_id "
"select t.id from topic t left join user_extra u on t.user_id = u.user_id "
"where u.is_shadow=0 and t.create_time > '
%
s' and t.create_time < '
%
s' and is_online=1 "
"where u.is_shadow=0 and t.create_time > '
%
s' and t.create_time < '
%
s' and
t.
is_online=1 "
"and t.content_level >=
%
s and t.content_level <=
%
s "
%
(
numtime
,
numtime2
,
str
(
content_level_low
),
str
(
content_level_top
)))
"and t.content_level >=
%
s and t.content_level <=
%
s "
%
(
numtime
,
numtime2
,
str
(
content_level_low
),
str
(
content_level_top
)))
res
=
cursor
.
fetch
one
()
res
=
cursor
.
fetch
all
()
for
i
,
in
res
:
for
i
,
in
res
:
cursor
.
execute
(
cursor
.
execute
(
...
...
vest/click/auto_click_per_2h_by_post.py
View file @
7e45a44a
...
@@ -18,10 +18,10 @@ def get_commnet_id(numtime, numtime2, content_level_low=0, content_level_top=6):
...
@@ -18,10 +18,10 @@ def get_commnet_id(numtime, numtime2, content_level_low=0, content_level_top=6):
cursor
.
execute
(
cursor
.
execute
(
"select t.id from topic t left join user_extra u on t.user_id = u.user_id "
"select t.id from topic t left join user_extra u on t.user_id = u.user_id "
"where u.is_shadow=0 and t.create_time > '
%
s' and t.create_time < '
%
s' and is_online=1 "
"where u.is_shadow=0 and t.create_time > '
%
s' and t.create_time < '
%
s' and
t.
is_online=1 "
"and t.content_level >=
%
s and t.content_level <=
%
s "
%
(
numtime
,
numtime2
,
str
(
content_level_low
),
str
(
content_level_top
)))
"and t.content_level >=
%
s and t.content_level <=
%
s "
%
(
numtime
,
numtime2
,
str
(
content_level_low
),
str
(
content_level_top
)))
res
=
cursor
.
fetch
one
()
res
=
cursor
.
fetch
all
()
for
i
,
in
res
:
for
i
,
in
res
:
cursor
.
execute
(
cursor
.
execute
(
...
...
vest/reply/auto_reply_per_1d_to_pictorial.py
0 → 100644
View file @
7e45a44a
import
pymysql
import
random
import
traceback
import
logging
from
threading
import
Thread
from
vest.request.auto_request
import
login
,
pictorial_reply
,
get_majia
,
get_pictorial_comment
,
time_convs
,
\
judge_pictorial_info_get_comment
from
vest.request.auto_request
import
host
,
user
,
db
,
passwd
from
vest.data.topic_models
import
get_pictorial_tag_by_id
"""
榜单新增内容(仅限在线的)
每半小时一次
过去半小时之内,if
新增在线帖子(既包含马甲用户、又包含普通用户)达到1个时,插入{1,2}条评论
新增在线帖子(既包含马甲用户、又包含普通用户)达到2-5个时,插入{2,3}条评论
新增在线帖子(既包含马甲用户、又包含普通用户)达到>5张时,插入{3,5}条评论
(注意评论作者需要是马甲用户)
过去半小时之内,if
本榜单有新增投票(既包含马甲用户、又包含普通用户),插入{1,2}条评论
评论取自单独的榜单评论列表,并自动随机关联马甲
注意需要禁止本帖作者评论
"""
def
get_data
(
numtime1
,
numtime2
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT pictorial_id ,count(*) as count FROM community_pictorial_topic WHERE is_online=1 and (create_time >= '
%
s' and create_time < '
%
s') group by pictorial_id "
%
(
numtime1
,
numtime2
))
res
=
cursor
.
fetchall
()
return
res
and
[
r
for
r
,
in
res
]
or
[]
except
:
logging
.
error
(
"catch exception,get_data:
%
s"
%
traceback
.
format_exc
())
return
[]
def
batch_handle
(
pictorial_id_list
):
for
pictorial_id
in
pictorial_id_list
:
try
:
cookies
=
login
()
if
cookies
is
not
None
:
comment
=
judge_pictorial_info_get_comment
(
pictorial_id
)
pictorial_reply
(
cookies
,
pictorial_id
,
comment
)
except
:
pass
def
auto_reply_per_1d_to_pictorial
():
# 问题自动增加回答
# todo topic_vote_cnt和community_pictorial_topic
# todo 1天前发的问题:[0-1]个评论 6天前发的问题:[0-1]个评论 这个是什么鬼
# todo 怎么禁止作者评论
pictorial_id_list
=
[]
try
:
logging
.
info
(
"comment offline pictorial"
)
numtime1
,
numtime2
=
time_convs
(
1
,
1
)
pictorial_ids
=
get_data
(
numtime1
,
numtime2
)
for
pictorial_id
in
pictorial_ids
:
random_num
=
random
.
randint
(
0
,
1
)
for
i
in
range
(
random_num
):
pictorial_id_list
.
append
(
pictorial_id
)
numtime1
,
numtime2
=
time_convs
(
2
,
6
)
pictorial_ids
=
get_data
(
numtime1
,
numtime2
)
for
pictorial_id
in
pictorial_ids
:
random_num
=
random
.
randint
(
0
,
1
)
for
i
in
range
(
random_num
):
pictorial_id_list
.
append
(
pictorial_id
)
else
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
total
=
len
(
pictorial_id_list
)
limit
=
(
total
+
10
)
//
10
for
start
in
range
(
0
,
total
,
limit
):
batch
=
pictorial_id_list
[
start
:
start
+
limit
]
t
=
Thread
(
target
=
batch_handle
,
args
=
[
batch
])
t
.
start
()
\ No newline at end of file
vest/reply/auto_reply_per_1d_to_topic.py
0 → 100644
View file @
7e45a44a
import
pymysql
import
traceback
import
logging
from
threading
import
Thread
from
vest.request.auto_request
import
login
,
time_convs
,
get_answer_data
,
reply_answer
,
get_majia
,
\
set_reply_to_redis
,
judge_topic_info_get_comment
,
reply
from
vest.request.auto_request
import
host
,
user
,
db
,
passwd
from
libs.error
import
logging_exception
import
random
def
get_data
(
numtime
,
numtime2
,
content_level_low
,
content_level_top
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT user_id,id FROM topic WHERE is_online=1 and (create_time >= '
%
s' and create_time <= '
%
s' )"
"and content_level>=
%
s and content_level<=
%
s"
%
(
numtime2
,
numtime
,
str
(
content_level_low
),
str
(
content_level_top
)))
res
=
cursor
.
fetchall
()
return
res
and
[
r
for
r
,
in
res
]
or
[]
except
:
logging
.
error
(
"catch exception,get_data:
%
s"
%
traceback
.
format_exc
())
return
[]
def
batch_handle
(
topic_id_list
):
for
topic_id
in
topic_id_list
:
try
:
cookies
=
login
()
if
cookies
is
not
None
:
comment
=
judge_topic_info_get_comment
(
topic_id
)
reply
(
cookies
,
topic_id
,
comment
)
except
:
logging_exception
()
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
def
auto_reply_per_1d_to_topic
():
topic_id_list
=
[]
try
:
# 1-3星及无星:
# 1天前发的帖子:[1-3]个评论
numtime1
,
numtime2
=
time_convs
(
1
,
1
)
topic_ids
=
get_data
(
numtime1
,
numtime2
,
0
,
3
)
for
topic_id
in
topic_ids
:
random_num
=
random
.
randint
(
1
,
3
)
for
num
in
range
(
random_num
):
topic_id_list
.
append
(
topic_id
)
# 2-6天前发的帖子:[0-1]个评论
numtime1
,
numtime2
=
time_convs
(
2
,
6
)
topic_ids
=
get_data
(
numtime1
,
numtime2
,
0
,
3
)
for
topic_id
in
topic_ids
:
random_num
=
random
.
randint
(
0
,
1
)
for
num
in
range
(
random_num
):
topic_id_list
.
append
(
topic_id
)
# 4-6星:
# 1天前发的帖子:[1-6]个评论
numtime1
,
numtime2
=
time_convs
(
1
,
1
)
topic_ids
=
get_data
(
numtime1
,
numtime2
,
4
,
6
)
for
topic_id
in
topic_ids
:
random_num
=
random
.
randint
(
1
,
6
)
for
num
in
range
(
random_num
):
topic_id_list
.
append
(
topic_id
)
# 2-6天前发的帖子:[1-3]个评论
numtime1
,
numtime2
=
time_convs
(
2
,
6
)
topic_ids
=
get_data
(
numtime1
,
numtime2
,
4
,
6
)
for
topic_id
in
topic_ids
:
random_num
=
random
.
randint
(
1
,
3
)
for
num
in
range
(
random_num
):
topic_id_list
.
append
(
topic_id
)
except
:
logging_exception
()
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
total
=
len
(
topic_id_list
)
limit
=
(
total
+
10
)
//
10
for
start
in
range
(
0
,
total
,
limit
):
batch
=
topic_id_list
[
start
:
start
+
limit
]
t
=
Thread
(
target
=
batch_handle
,
args
=
[
batch
])
t
.
start
()
\ No newline at end of file
vest/reply/auto_reply_per_2h_to_topic.py
0 → 100644
View file @
7e45a44a
import
pymysql
import
traceback
import
logging
from
threading
import
Thread
from
vest.request.auto_request
import
login
,
time_conv_hour
,
get_answer_data
,
reply_answer
,
get_majia
,
\
set_reply_to_redis
,
judge_topic_info_get_comment
,
reply
from
vest.request.auto_request
import
host
,
user
,
db
,
passwd
from
libs.error
import
logging_exception
import
random
def
get_data
(
numtime
,
numtime2
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT user_id,id FROM topic WHERE is_online=1 and (create_time >= '
%
s' and create_time <= '
%
s' )"
%
(
numtime2
,
numtime
))
res
=
cursor
.
fetchall
()
return
res
and
[
r
for
r
,
in
res
]
or
[]
except
:
logging
.
error
(
"catch exception,get_data:
%
s"
%
traceback
.
format_exc
())
return
[]
def
batch_handle
(
topic_id_list
):
for
topic_id
in
topic_id_list
:
try
:
cookies
=
login
()
if
cookies
is
not
None
:
comment
=
judge_topic_info_get_comment
(
topic_id
)
reply
(
cookies
,
topic_id
,
comment
)
except
:
logging_exception
()
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
def
auto_reply_per_2h_to_topic
():
topic_id_list
=
[]
try
:
numtime1
,
numtime2
=
time_conv_hour
(
0
,
2
)
topic_ids
=
get_data
(
numtime1
,
numtime2
)
for
topic_id
in
topic_ids
:
random_num
=
random
.
randint
(
1
,
2
)
for
num
in
range
(
random_num
):
topic_id_list
.
append
(
topic_id
)
except
:
logging_exception
()
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
total
=
len
(
topic_id_list
)
limit
=
(
total
+
10
)
//
10
for
start
in
range
(
0
,
total
,
limit
):
batch
=
topic_id_list
[
start
:
start
+
limit
]
t
=
Thread
(
target
=
batch_handle
,
args
=
[
batch
])
t
.
start
()
\ No newline at end of file
vest/request/auto_request.py
View file @
7e45a44a
...
@@ -604,7 +604,6 @@ def judge_topic_info_get_comment(topic_id):
...
@@ -604,7 +604,6 @@ def judge_topic_info_get_comment(topic_id):
comment
=
get_face_comment
()
comment
=
get_face_comment
()
# 原始评论
# 原始评论
else
:
else
:
comment
=
get_comment
()
comment
=
get_comment
()
else
:
else
:
...
...
vest/request/get_session.py
View file @
7e45a44a
...
@@ -16,6 +16,31 @@ def index_first():
...
@@ -16,6 +16,31 @@ def index_first():
return
None
return
None
def
get_cook_by_email
(
email
):
try
:
cookies
=
index_first
()
post_dict
=
{
'account_type'
:
2
,
'pwd'
:
'123456'
,
'email'
:
email
}
response
=
requests
.
post
(
url
=
settings
.
LOGIN_URL
,
data
=
post_dict
,
cookies
=
cookies
)
headers
=
response
.
headers
print
(
response
.
text
)
cook
=
headers
[
'Set-Cookie'
]
.
split
(
";"
)
cook
=
cook
[
0
]
.
split
(
'='
)[
1
]
logging
.
info
(
"response.text :
%
s"
%
response
.
text
)
return
cook
except
:
logging
.
error
(
"index_first:
%
s"
%
traceback
.
format_exc
())
return
None
def
get_cook
():
def
get_cook
():
try
:
try
:
data
=
open
(
"/srv/apps/physical/vest/data/vest_user_email.txt"
)
data
=
open
(
"/srv/apps/physical/vest/data/vest_user_email.txt"
)
...
...
vest/test.py
View file @
7e45a44a
...
@@ -149,4 +149,33 @@ def follow(cookies_get, id):
...
@@ -149,4 +149,33 @@ def follow(cookies_get, id):
print
(
response
.
text
)
print
(
response
.
text
)
follow
({
'sessionid'
:
'qsukyafj7ub2f43f33g2jm0kkvqf0sa7'
},
241765445
)
def
index_first
():
try
:
r1
=
requests
.
get
(
"http://earth.gmapp.env/api/account/login_pwd"
)
return
r1
.
cookies
.
get_dict
()
except
:
return
None
def
get_cook_by_email
(
email
):
cookies
=
index_first
()
post_dict
=
{
'account_type'
:
2
,
'pwd'
:
'123456'
,
'email'
:
email
}
response
=
requests
.
post
(
url
=
"http://earth.gmapp.env/api/account/login_pwd"
,
data
=
post_dict
,
cookies
=
cookies
)
headers
=
response
.
headers
# print(response.text)
cook
=
headers
[
'Set-Cookie'
]
.
split
(
";"
)
cook
=
cook
[
0
]
.
split
(
'='
)[
1
]
return
cook
res
=
get_cook_by_email
(
"s_gXRMNW@shadow.com"
)
print
(
res
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment