Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
crawler
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
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
backend
crawler
Commits
2c8b099d
Commit
2c8b099d
authored
Dec 04, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
524cbedd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
temp_service_to_redis.py
test/temp_service_to_redis.py
+23
-20
No files found.
test/temp_service_to_redis.py
View file @
2c8b099d
...
@@ -558,7 +558,6 @@ query_list = ["双眼皮",
...
@@ -558,7 +558,6 @@ query_list = ["双眼皮",
"鼻头缩小"
,
"鼻头缩小"
,
"超光子"
,
"超光子"
,
"牙贴面"
,
"牙贴面"
,
""
,
"铜雀台"
,
"铜雀台"
,
"减肥"
,
"减肥"
,
"冰点脱毛"
,
"冰点脱毛"
,
...
@@ -1481,8 +1480,6 @@ city_list = {
...
@@ -1481,8 +1480,6 @@ city_list = {
"sichuan"
:
755
,
"sichuan"
:
755
,
"sichuan"
:
756
,
"sichuan"
:
756
,
"guizhou"
:
757
,
"guizhou"
:
757
,
}
}
import
requests
import
requests
import
redis
import
redis
...
@@ -1499,21 +1496,26 @@ rds = redis.StrictRedis.from_url("redis://:XfkMCCdWDIU%ls$h3@172.16.50.159:6379"
...
@@ -1499,21 +1496,26 @@ rds = redis.StrictRedis.from_url("redis://:XfkMCCdWDIU%ls$h3@172.16.50.159:6379"
for
query
in
query_list
:
for
query
in
query_list
:
res
=
json
.
dumps
(
query
)
res
=
json
.
dumps
(
query
)
for
city
in
city_list
:
for
city
in
city_list
:
pass
try
:
data
=
{
key
=
"meigou_"
+
city
+
"_"
+
query
'requests'
:
'[{"method": "rims/search/cpt_service", "params": {"sort_with_submission": true, '
if
rds
.
exists
(
key
):
'"city_id": "
%
s", "is_feed": false, "sort_type": 0, "sort_params": {"query":
%
s,'
continue
' "user_city_tag_id":
%
s, "in_whitelist": true,"device_id": '
data
=
{
'"868741039702733996"}, "filters": {}, "offset":0, "query":
%
s, '
'requests'
:
'[{"method": "rims/search/cpt_service", "params": {"sort_with_submission": true, '
'"size": 100, "is_operation_cpt": true, "is_merchant_cpt": true, '
'"city_id": "
%
s", "is_feed": false, "sort_type": 0, "sort_params": {"query":
%
s,'
'"device_id": "860281041353608", "user_city_tag_id":
%
s}, "timeout": 120}]'
%
' "user_city_tag_id":
%
s, "in_whitelist": true,"device_id": '
(
city
,
str
(
res
),
city_list
[
city
],
str
(
res
),
city_list
[
city
])
'"868741039702733996"}, "filters": {}, "offset":0, "query":
%
s, '
}
'"size": 100, "is_operation_cpt": true, "is_merchant_cpt": true, '
# print(data)
'"device_id": "860281041353608", "user_city_tag_id":
%
s}, "timeout": 120}]'
%
response
=
requests
.
post
(
'http://172.16.50.10:8170/v1/batch'
,
headers
=
headers
,
data
=
data
)
(
city
,
str
(
res
),
city_list
[
city
],
str
(
res
),
city_list
[
city
])
data
=
json
.
dumps
(
response
.
json
())
}
time
.
sleep
(
1
)
# print(data)
key
=
"meigou_"
+
city
+
"_"
+
query
response
=
requests
.
post
(
'http://172.16.50.10:8170/v1/batch'
,
headers
=
headers
,
data
=
data
)
print
(
key
)
data
=
json
.
dumps
(
response
.
json
())
rds
.
set
(
key
,
data
)
time
.
sleep
(
0.2
)
print
(
key
)
rds
.
set
(
key
,
data
)
except
:
continue
# break
# break
\ 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