Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
checkData
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ZGC_INDEX
checkData
Commits
8aa6d00e
Commit
8aa6d00e
authored
Mar 20, 2020
by
rico.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update whiteword
parent
4e536334
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
14 deletions
+34
-14
checkData.py
checkData.py
+34
-14
No files found.
checkData.py
View file @
8aa6d00e
...
...
@@ -11,6 +11,7 @@ import re
import
requests
import
json
import
pymssql
import
pandas
as
pd
def
get_response
(
session
,
url
,
headers
):
'''
...
...
@@ -40,9 +41,9 @@ def checkData(check_data):
conn
=
pymssql
.
connect
(
host
=
'123.56.115.207'
,
user
=
'zgcprice3311'
,
password
=
'admin@2018@)!*'
,
database
=
'zi_zh'
,
autocommit
=
True
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
'select stop_word from Stopwords'
)
cursor
.
execute
(
'select stop_word
,white_word
from Stopwords'
)
data
=
(
cursor
.
fetchall
())
stopword_list
=
pd
.
DataFrame
(
data
,
columns
=
[
'stopword'
])[
'stopword'
]
.
tolist
(
)
word_df
=
pd
.
DataFrame
(
data
,
columns
=
[
'stopword'
,
'whiteword'
]
)
headers
=
{
'User-Agent'
:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'
}
session
=
requests
.
Session
()
...
...
@@ -101,11 +102,18 @@ def checkData(check_data):
if
"自营"
in
str
(
ziying
):
name
=
html
.
xpath
(
"//div[@class='sku-name']/text()"
)
flag
=
False
for
stopword
in
stopword_list
:
if
stopword
in
str
(
name
):
flag
=
True
break
for
stopword
,
whitewords
in
zip
(
list
(
word_df
[
'stopword'
]),
list
(
word_df
[
'whiteword'
])):
try
:
whiteword_list
=
whitewords
.
split
(
'/'
)
print
(
whiteword_list
)
except
:
whiteword_list
=
[]
for
whiteword
in
whiteword_list
:
if
stopword
in
str
(
name
)
and
whiteword
not
in
str
(
name
):
flag
=
True
break
if
flag
:
print
(
"定制/专用/书籍类产品暂不通过"
)
...
...
@@ -198,10 +206,16 @@ def checkData(check_data):
name
=
html
.
xpath
(
"//*[@id='gm-prd-main']/div[1]/h1/text()"
)
flag
=
False
for
stopword
in
stopword_list
:
if
stopword
in
str
(
name
):
flag
=
True
break
for
stopword
,
whitewords
in
zip
(
list
(
word_df
[
'stopword'
]),
list
(
word_df
[
'whiteword'
])):
try
:
whiteword_list
=
whitewords
.
split
(
'/'
)
print
(
whiteword_list
)
except
:
whiteword_list
=
[]
for
whiteword
in
whiteword_list
:
if
stopword
in
str
(
name
)
and
whiteword
not
in
str
(
name
):
flag
=
True
break
if
flag
:
print
(
"定制/专用/书籍类产品暂不通过"
)
result
.
append
(
"定制/专用/书籍类产品暂不通过"
)
...
...
@@ -280,10 +294,16 @@ def checkData(check_data):
if
isPublished
==
'1'
:
if
'此款有货'
in
str
(
youhuo_
)
:
flag
=
False
for
stopword
in
stopword_list
:
if
stopword
in
str
(
name
):
flag
=
True
break
for
stopword
,
whitewords
in
zip
(
list
(
word_df
[
'stopword'
]),
list
(
word_df
[
'whiteword'
])):
try
:
whiteword_list
=
whitewords
.
split
(
'/'
)
print
(
whiteword_list
)
except
:
whiteword_list
=
[]
for
whiteword
in
whiteword_list
:
if
stopword
in
str
(
name
)
and
whiteword
not
in
str
(
name
):
flag
=
True
break
if
flag
:
print
(
"定制/专用/书籍类产品暂不通过"
)
result
.
append
(
"定制/专用/书籍类产品暂不通过"
)
...
...
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