Commit 3c19d6e7 authored by 李小芳's avatar 李小芳

add

parent 3310832b
...@@ -99,22 +99,28 @@ class CrawlerMain(object): ...@@ -99,22 +99,28 @@ class CrawlerMain(object):
except ReadTimeout: except ReadTimeout:
print('timeout') print('timeout')
pass pass
return None, None
except HTTPError: except HTTPError:
print('httperror') print('httperror')
pass pass
return None, None
# 请求异常 # 请求异常
except RequestException: except RequestException:
print('reqerror') print('reqerror')
pass pass
return None, None
except socket.timeout: except socket.timeout:
print(socket.timeout) print(socket.timeout)
pass pass
return None, None
except ReadTimeoutError: except ReadTimeoutError:
print("ReadTimeoutError") print("ReadTimeoutError")
pass pass
return None, None
except ConnectionError: except ConnectionError:
print("ConnectionError") print("ConnectionError")
pass pass
return None, None
def get_search_service_info_list(self, page=1, city_id=-1, query=""): def get_search_service_info_list(self, page=1, city_id=-1, query=""):
url = "https://www.soyoung.com/searchNew/product?" \ url = "https://www.soyoung.com/searchNew/product?" \
...@@ -128,22 +134,28 @@ class CrawlerMain(object): ...@@ -128,22 +134,28 @@ class CrawlerMain(object):
except ReadTimeout: except ReadTimeout:
print('超时,执行下一个请求') print('超时,执行下一个请求')
pass pass
return None
except HTTPError: except HTTPError:
print('httperror') print('httperror')
pass pass
return None
# 请求异常 # 请求异常
except RequestException: except RequestException:
print('reqerror') print('reqerror')
pass pass
return None
except socket.timeout: except socket.timeout:
print(socket.timeout) print(socket.timeout)
pass pass
return None
except ReadTimeoutError: except ReadTimeoutError:
print("ReadTimeoutError") print("ReadTimeoutError")
pass pass
return None
except ConnectionError: except ConnectionError:
print("ConnectionError") print("ConnectionError")
pass pass
return None
def get_services_list(self, res_json, query="", city_name=""): def get_services_list(self, res_json, query="", city_name=""):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment