51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
import requests
|
|
import json
|
|
|
|
TOKEN = "afxp_fa4137GfIzJtlOCeQHjpCXc83SFWmeAOrZnq"
|
|
PROJECT_ID = "6037107"
|
|
FOLDER_ID = "78015216" # 门店端-新版
|
|
|
|
headers = {
|
|
"X-Apifox-Api-Version": "2024-03-28",
|
|
"Authorization": f"Bearer {TOKEN}"
|
|
}
|
|
|
|
print("=" * 80)
|
|
print("验证接口是否在 [门店端-新版] 目录下")
|
|
print("=" * 80)
|
|
print(f"项目ID: {PROJECT_ID}")
|
|
print(f"目录ID: {FOLDER_ID}")
|
|
print("-" * 80)
|
|
|
|
# 获取目录下的所有接口
|
|
response = requests.get(
|
|
f"https://api.apifox.com/api/v1/projects/{PROJECT_ID}/http-apis",
|
|
headers=headers
|
|
)
|
|
|
|
if response.status_code == 200:
|
|
result = response.json()
|
|
apis_data = result.get('data', [])
|
|
|
|
# 筛选出在目标目录下的接口
|
|
folder_apis = [api for api in apis_data if str(api.get('folderId')) == FOLDER_ID]
|
|
|
|
print(f"\n在 [门店端-新版] 目录下找到 {len(folder_apis)} 个接口:\n")
|
|
|
|
for i, api in enumerate(folder_apis, 1):
|
|
method = api.get('method', '').upper()
|
|
name = api.get('name', '')
|
|
path = api.get('path', '')
|
|
api_id = api.get('id', '')
|
|
print(f"[{i}] {method:6s} {name:20s} {path}")
|
|
print(f" API ID: {api_id}")
|
|
|
|
print("\n" + "=" * 80)
|
|
print("[OK] 验证完成!")
|
|
print("=" * 80)
|
|
else:
|
|
print(f"[ERROR] 请求失败: HTTP {response.status_code}")
|
|
print(response.text)
|
|
|