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
43d2037c
Commit
43d2037c
authored
Jul 19, 2021
by
李小芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
6d6ad627
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
12 deletions
+0
-12
crawler_xinyang_ask_service.py
dev/xinyang_ask_tag/crawler_xinyang_ask_service.py
+0
-6
crawler_xinyang_ask_service_city.py
dev/xinyang_ask_tag/crawler_xinyang_ask_service_city.py
+0
-6
No files found.
dev/xinyang_ask_tag/crawler_xinyang_ask_service.py
View file @
43d2037c
...
...
@@ -92,11 +92,8 @@ class CrawlerMain(object):
try
:
requests_res
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
allow_redirects
=
False
,
timeout
=
10
)
# 打印状态码
if
requests_res
.
status_code
==
200
:
page_obj
=
etree
.
HTML
(
requests_res
.
text
)
return
page_obj
,
url
else
:
return
None
,
url
except
ReadTimeout
:
print
(
'timeout'
)
...
...
@@ -124,11 +121,8 @@ class CrawlerMain(object):
.
format
(
query
,
page
)
try
:
requests_res
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
allow_redirects
=
False
,
timeout
=
10
)
if
requests_res
.
status_code
==
200
:
res_json
=
requests_res
.
json
()
return
res_json
else
:
return
None
except
ReadTimeout
:
print
(
'超时,执行下一个请求'
)
...
...
dev/xinyang_ask_tag/crawler_xinyang_ask_service_city.py
View file @
43d2037c
...
...
@@ -93,11 +93,8 @@ class CrawlerMain(object):
try
:
requests_res
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
allow_redirects
=
False
,
timeout
=
10
)
# 打印状态码
if
requests_res
.
status_code
==
200
:
page_obj
=
etree
.
HTML
(
requests_res
.
text
)
return
page_obj
,
url
else
:
return
None
,
url
except
ReadTimeout
:
print
(
'timeout'
)
return
None
,
url
...
...
@@ -124,11 +121,8 @@ class CrawlerMain(object):
.
format
(
query
,
page
)
try
:
requests_res
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
allow_redirects
=
False
,
timeout
=
10
)
if
requests_res
.
status_code
==
200
:
res_json
=
requests_res
.
json
()
return
res_json
else
:
return
None
except
ReadTimeout
:
print
(
'超时,执行下一个请求'
)
...
...
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