From 95151579f1978459680a09053d802dcec3d28a30 Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Fri, 30 Aug 2024 02:53:40 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E9=85=92=E5=BA=97=E6=BA=90.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py/酒店源.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/py/酒店源.py b/py/酒店源.py index 4f48681..b79001c 100644 --- a/py/酒店源.py +++ b/py/酒店源.py @@ -53,7 +53,7 @@ def modify_urls(url): def is_url_accessible(url): try: - response = requests.get(url, timeout=10) + response = requests.get(url, timeout=3) if 200 <= response.status_code <= 401: return url except requests.exceptions.RequestException: @@ -106,7 +106,7 @@ for url in urls: try: # 发送GET请求获取JSON文件,设置超时时间为0.5秒 json_url = f"{url}" - response = requests.get(json_url, timeout=10)################################ + response = requests.get(json_url, timeout=3)################################ json_data = response.content.decode('utf-8') try: # 按行分割数据 @@ -292,7 +292,7 @@ def modify_urls(url): def is_url_accessible(url): try: - response = requests.get(url, timeout=10) + response = requests.get(url, timeout=3) if 200 <= response.status_code <= 401: return url except requests.exceptions.RequestException: @@ -357,7 +357,7 @@ for url in urls: # 将原始URL赋值给json_url变量 json_url = f"{url}" # 使用requests库发起一个GET请求到json_url,超时时间设置为3秒 - response = requests.get(json_url, timeout=10) + response = requests.get(json_url, timeout=3) # 将响应的内容解析为JSON格式 json_data = response.json() try: