import requests from bs4 import BeautifulSoup # 标准访问格式 def Link(url, headers): try: response = requests.get(url, headers=headers) response.raise_for_status() # 检查请求是否成功 html = response.text soup = BeautifulSoup(html, 'html.parser') return soup except requests.exceptions.RequestException as e: print("Wrong:", e) return None