Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
search_custom_analyse
Overview
Overview
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
田川
search_custom_analyse
Commits
52e7b5cd
Commit
52e7b5cd
authored
Dec 09, 2020
by
zhaoyanchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改脚本
parent
997e6ca2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
get_user_brand_favor_linux.py
src/get_user_brand_favor_linux.py
+8
-3
get_user_brand_favor_windows.py
src/get_user_brand_favor_windows.py
+7
-2
No files found.
src/get_user_brand_favor_linux.py
View file @
52e7b5cd
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
import
requests
import
requests
import
codecs
import
codecs
import
sys
import
sys
import
traceback
reload
(
sys
)
reload
(
sys
)
sys
.
setdefaultencoding
(
'utf-8'
)
sys
.
setdefaultencoding
(
'utf-8'
)
...
@@ -29,9 +31,12 @@ def trans_brand_id_2_name(brand_id):
...
@@ -29,9 +31,12 @@ def trans_brand_id_2_name(brand_id):
try
:
try
:
res
=
requests
.
get
(
solr_brand_query_url
+
str
(
brand_id
))
res
=
requests
.
get
(
solr_brand_query_url
+
str
(
brand_id
))
result
=
res
.
json
()
result
=
res
.
json
()
return
result
.
get
(
'response'
)[
'docs'
][
0
][
'brandCName'
]
docs
=
result
.
get
(
'response'
)[
'docs'
]
if
len
(
docs
)
>
0
:
return
docs
[
0
][
'brandCName'
]
return
'NO_BRAND_IN_SOLR'
except
Exception
as
err
:
except
Exception
as
err
:
print
(
err
)
traceback
.
print_exc
(
)
...
@@ -68,7 +73,7 @@ def get_favor_brands(device_id):
...
@@ -68,7 +73,7 @@ def get_favor_brands(device_id):
favor_brands
.
other_brand_names
+=
trans_brand_id_2_name
(
brand_id
)
+
", "
favor_brands
.
other_brand_names
+=
trans_brand_id_2_name
(
brand_id
)
+
", "
except
Exception
as
err
:
except
Exception
as
err
:
print
(
err
)
traceback
.
print_exc
(
)
return
favor_brands
return
favor_brands
...
...
src/get_user_brand_favor_windows.py
View file @
52e7b5cd
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
import
requests
import
requests
import
codecs
import
codecs
import
sys
import
traceback
file_path
=
r'G:\Code\python\search_custom_analyse\data\cateword_but_no_hit.txt'
file_path
=
r'G:\Code\python\search_custom_analyse\data\cateword_but_no_hit.txt'
user_profile_file
=
r'user_brand_favor.txt'
user_profile_file
=
r'user_brand_favor.txt'
...
@@ -27,8 +29,11 @@ def trans_brand_id_2_name(brand_id):
...
@@ -27,8 +29,11 @@ def trans_brand_id_2_name(brand_id):
res
=
requests
.
get
(
solr_brand_query_url
+
str
(
brand_id
))
res
=
requests
.
get
(
solr_brand_query_url
+
str
(
brand_id
))
result
=
res
.
json
()
result
=
res
.
json
()
return
result
.
get
(
'response'
)[
'docs'
][
0
][
'brandCName'
]
return
result
.
get
(
'response'
)[
'docs'
][
0
][
'brandCName'
]
if
len
(
docs
)
>
0
:
return
docs
[
0
][
'brandCName'
]
return
'NO_BRAND_IN_SOLR'
except
Exception
as
err
:
except
Exception
as
err
:
print
(
err
)
traceback
.
print_exc
(
)
...
@@ -64,7 +69,7 @@ def get_favor_brands(device_id):
...
@@ -64,7 +69,7 @@ def get_favor_brands(device_id):
favor_brands
.
other_brand_names
+=
trans_brand_id_2_name
(
brand_id
)
+
", "
favor_brands
.
other_brand_names
+=
trans_brand_id_2_name
(
brand_id
)
+
", "
except
Exception
as
err
:
except
Exception
as
err
:
print
(
err
)
traceback
.
print_exc
(
)
return
favor_brands
return
favor_brands
...
...
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