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
108374fa
authored
Oct 17, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add insert pop class
parent
dfa8eb46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
test5.py
test5.py
View file @
108374fa
...
@@ -87,18 +87,23 @@ def get_pop_class():
...
@@ -87,18 +87,23 @@ def get_pop_class():
ans
=
request_to_jd_pop
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
ans
=
request_to_jd_pop
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
return
ans
return
ans
def
get_pop_attr
():
def
get_pop_attr
(
class_id
:
int
):
method_name
=
"jingdong.category.read.findAttrsByCategoryIdUnlimitCate"
method_name
=
"jingdong.category.read.findAttrsByCategoryIdUnlimitCate"
token
=
"74ee3f2fa54d489da0d1b94ca83c9bc7lztn"
token
=
"74ee3f2fa54d489da0d1b94ca83c9bc7lztn"
app_key
=
"CCE6563827D13EDF4769C01E7429378D"
app_key
=
"CCE6563827D13EDF4769C01E7429378D"
app_secret
=
"98c72374c5b045529879786fc4e5c20e"
app_secret
=
"98c72374c5b045529879786fc4e5c20e"
param
=
{
"cid"
:
class_id
,
"field"
:
"attrValueList"
}
ans
=
request_to_jd_pop
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
return
ans
def
insert_pop_class_to_db
():
def
insert_pop_class_to_db
():
ans
=
get_pop_class
()
ans
=
get_pop_class
()
data
=
ans
[
"jingdong_vender_category_getFullValidCategoryResultByVenderId_responce"
][
"returnType"
][
"list"
]
data
=
ans
[
"jingdong_vender_category_getFullValidCategoryResultByVenderId_responce"
][
"returnType"
][
"list"
]
config
=
config_
dev
config
=
config_
prod
db
=
pymysql
.
connect
(
host
=
config
[
"mysql"
][
"host"
],
db
=
pymysql
.
connect
(
host
=
config
[
"mysql"
][
"host"
],
port
=
config
[
"mysql"
][
"port"
],
port
=
config
[
"mysql"
][
"port"
],
user
=
config
[
"mysql"
][
"user"
],
user
=
config
[
"mysql"
][
"user"
],
...
@@ -119,6 +124,22 @@ def insert_pop_class_to_db():
...
@@ -119,6 +124,22 @@ def insert_pop_class_to_db():
print
(
sql
%
(
parent_id
,
class_id
,
class_name
,
depth
,
status
,
platform
,
create_time
))
print
(
sql
%
(
parent_id
,
class_id
,
class_name
,
depth
,
status
,
platform
,
create_time
))
def
insert_pop_attr_to_db
():
config
=
config_dev
select_sql
=
"select class_id from lie_shop_class where platform = 3"
db
=
pymysql
.
connect
(
host
=
config
[
"mysql"
][
"host"
],
port
=
config
[
"mysql"
][
"port"
],
user
=
config
[
"mysql"
][
"user"
],
database
=
config
[
"mysql"
][
"database"
],
password
=
config
[
"mysql"
][
"password"
])
cursor
=
db
.
cursor
()
cursor
.
execute
(
query
=
select_sql
)
result
=
cursor
.
fetchall
()
for
i
in
range
(
len
(
result
)):
class_id
=
result
[
i
][
0
]
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
insert_pop_class_to_db
()
insert_pop_class_to_db
()
\ 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