diff --git a/requirements.txt b/requirements.txt index 9ef6c6b..81d03cf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,5 @@ django==2.2.13 django-simpleui==3.9.1 django-apscheduler==0.3.0 django-import-export==2.0.2 -slack-sdk==3.2.1 \ No newline at end of file +slack-sdk==3.2.1 +parsel==1.7.0 diff --git a/task/utils/selector/request_selector.py b/task/utils/selector/request_selector.py index dbc452b..f350f34 100644 --- a/task/utils/selector/request_selector.py +++ b/task/utils/selector/request_selector.py @@ -18,6 +18,8 @@ def get_html(self, url, headers): r = requests.get(url, headers=header_dict, timeout=10) else: r = requests.get(url, timeout=10) + if r.status_code != 200: + raise Exception('访问错误: ', r.status_code) r.encoding = r.apparent_encoding html = r.text return html