Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
V
vest
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
2
Merge Requests
2
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
rank
vest
Commits
d23683fd
Commit
d23683fd
authored
Dec 26, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto_vest
parent
6bf67715
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
consum.py
moment/views/consum.py
+3
-1
process_time.py
moment/views/process_time.py
+1
-1
No files found.
moment/views/consum.py
View file @
d23683fd
...
...
@@ -26,7 +26,7 @@ def kafka_consum(topic_name=None):
consumser_obj
.
subscribe
([
topic_name
,
])
try
:
while
True
:
msg_dict
=
consumser_obj
.
poll
(
timeout_ms
=
100
,
max_records
=
3
0
)
msg_dict
=
consumser_obj
.
poll
(
timeout_ms
=
100
,
max_records
=
5
0
)
consumser_obj
.
commit_async
()
for
msg_key
in
msg_dict
:
consume_msg
=
msg_dict
[
msg_key
]
...
...
@@ -51,6 +51,7 @@ def kafka_consum(topic_name=None):
elif
card_info
[
'action_type'
]
==
"follow"
:
auto_follow_user
(
card_info
,
after_day
=
True
)
else
:
pass
...
...
@@ -94,6 +95,7 @@ def kafka_consum(topic_name=None):
logging
.
info
(
"get------xiafa------------vestclick:
%
s"
%
card_info
)
auto_click_user
(
card_info
)
elif
action_type
==
"follow"
:
# 在这里去调关注的接口
if
'have_follow_number'
in
card_info
and
\
...
...
moment/views/process_time.py
View file @
d23683fd
...
...
@@ -15,6 +15,7 @@ import pymysql
from
bs4
import
BeautifulSoup
logger
=
logging
.
getLogger
(
__name__
)
producer
=
KafkaProducer
(
bootstrap_servers
=
settings
.
KAFKA_BROKER_LIST
)
def
strTimeProp
(
start
,
end
,
prop
,
frmt
):
...
...
@@ -261,7 +262,6 @@ def get_click_follow_time_by_create_time(create_time="", content_level=0, action
def
save_data_to_kafka
(
card_info
):
try
:
producer
=
KafkaProducer
(
bootstrap_servers
=
settings
.
KAFKA_BROKER_LIST
)
topic
=
settings
.
KAFKA_TOPIC_NAME
producer
.
send
(
topic
,
json
.
dumps
(
card_info
)
.
encode
())
producer
.
close
()
...
...
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