Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
jd_data_process
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1516df54
authored
Oct 14, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add push sku
parent
a20efe85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
push_to_mq.py
test2.py
push_to_mq.py
View file @
1516df54
import
json
import
pika
# 推送消息到 mq测试脚本
...
...
@@ -8,7 +10,8 @@ host = '192.168.1.237'
port
=
5672
queue_name
=
'liexin_nplm_filter_sku_data'
def
push_mq
(
message
:
str
):
def
push_mq
(
message
:
str
):
credentials
=
pika
.
PlainCredentials
(
username
=
username
,
password
=
password
)
conn
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
host
,
...
...
@@ -17,12 +20,15 @@ def push_mq(message:str):
))
channel
=
conn
.
channel
()
channel
.
queue_declare
(
queue
=
queue_name
,
durable
=
True
)
channel
.
basic_publish
(
body
=
str
.
encode
(
message
))
channel
.
basic_publish
(
exchange
=
""
,
routing_key
=
"liexin_nplm_filter_sku_data"
,
body
=
str
.
encode
(
message
))
channel
.
close
()
conn
.
close
()
# {"goods_id":1170115972487102103,"spu_id":2170115972437912400,"platform":1,"shop_id":1}
if
__name__
==
'__main__'
:
pass
\ No newline at end of file
data
=
{
"goods_id"
:
1170115972487102103
,
"spu_id"
:
2170115972437912400
,
"platform"
:
1
,
"shop_id"
:
1
}
msg
=
json
.
dumps
(
data
,
ensure_ascii
=
False
)
push_mq
(
msg
)
test2.py
View file @
1516df54
...
...
@@ -16,4 +16,15 @@ if __name__ == '__main__':
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
# {"brand_id":824064,"cid1":33465,"height":1,"intro_html":"\u003cimg src=https://img30.360buyimg.com/sku/jfs/t1/133800/28/25551/94742/62fef403E1a77f3a2/9b92597c0c26d1c8.jpg'
# /\u003e\u003cbr\u003e","intro_mobile":"\u003cimg src=https://img30.360buyimg.com/sku/jfs/t1/133800/28/25551/94742/62fef403E1a77f3a2/9b92597c0c26d1c8.jpg' /\u003e\u003cbr\u0
# 03e","item_num":"1170115972487102103","length":1,"main_isPrimary":"1","main_path":"jfs/t1/218495/17/44520/6140/670c8f12F36300d6c/ad09ab26fba5cc12.jpg","market_price":692.25
# ,"member_price":629.31,"model":"MEK300-06DA","name":"IXYS 音频变压器 MEK300-06DA","original_place":"中国大陆","pack_type":1,"pkg_info":"商品主体 * 1","prop_id":"235815,2338
# 59,233856,233862,233865,233870,233876,233883,233890,233899,270353,270354,274403","prop_remark":"11,11,11,11,11,11,11,11,11,11,,11","prop_vid":",,,,,,,,,,1639264,","purchase
# _price":572.0953,"purchaser_code":"maojingtao1","saler_code":"maojingtao1","warranty":"无质保","weight":1,"width":1}
# .\gf_windows_amd64.exe gen dao -l "mysql:liexin_data_distribution:liexin_data_distribution#zsyM@tcp(192.168.1.238:3306)/liexin_data_distribution" -t "lie_shop_push_sku_log" -r "lie_"
\ 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