调试网络

This commit is contained in:
gongwenxin
2025-08-07 15:23:25 +08:00
parent fa343eb111
commit 53aa2a647b
10 changed files with 602 additions and 9 deletions
+10 -3
View File
@@ -4,6 +4,7 @@ from typing import List, Dict, Any, Optional, Union, Tuple
import requests
from urllib.parse import urljoin
import copy
import urllib3
logger = logging.getLogger(__name__)
@@ -535,8 +536,14 @@ class InputParser:
self.logger.error(f"An unexpected error occurred while parsing Swagger spec {file_path}: {e}", exc_info=True)
return None
def parse_dms_spec(self, domain_mapping_path: str, base_url: str, headers: Optional[Dict[str, str]] = None) -> Optional[ParsedDMSSpec]:
def parse_dms_spec(self, domain_mapping_path: str, base_url: str, headers: Optional[Dict[str, str]] = None, ignore_ssl: bool = False) -> Optional[ParsedDMSSpec]:
self.logger.info(f"Starting DMS spec parsing. Base URL: {base_url}, Domain Map: {domain_mapping_path}")
if ignore_ssl:
self.logger.warning("SSL certificate verification is disabled for DMS API calls. This is not recommended for production use.")
# 禁用SSL警告
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
headers = headers or {}
try:
@@ -549,7 +556,7 @@ class InputParser:
list_url = urljoin(base_url, "/api/schema/manage/schema")
self.logger.info(f"Fetching API list from: {list_url}")
try:
response = requests.get(list_url, headers=headers)
response = requests.get(list_url, headers=headers, verify=not ignore_ssl)
response.raise_for_status()
api_list_data = response.json()
@@ -587,7 +594,7 @@ class InputParser:
self.logger.info(f"Fetching model for '{name}' from: {model_url}")
try:
response = requests.get(model_url, headers=headers)
response = requests.get(model_url, headers=headers, verify=not ignore_ssl)
response.raise_for_status()
model_schema_response = response.json()
except requests.exceptions.RequestException as e: