54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
from typing import Dict
|
|
|
|
class Config:
|
|
"""配置管理类"""
|
|
|
|
def __init__(self):
|
|
"""初始化配置"""
|
|
# API基础URL
|
|
self.base_url = "https://cursorapi.nosqli.com"
|
|
|
|
# API端点
|
|
self.api_endpoints = {
|
|
"get_unused": f"{self.base_url}/admin/api.account/getUnused",
|
|
"activate": f"{self.base_url}/admin/api.member/activate",
|
|
"status": f"{self.base_url}/admin/api.member/status",
|
|
"heartbeat": f"{self.base_url}/admin/api.account/heartbeat"
|
|
}
|
|
|
|
# API请求配置
|
|
self.request_config = {
|
|
"timeout": 30,
|
|
"verify": False,
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
}
|
|
}
|
|
|
|
@property
|
|
def get_unused_url(self) -> str:
|
|
"""获取未使用账号的API地址"""
|
|
return self.api_endpoints["get_unused"]
|
|
|
|
@property
|
|
def activate_url(self) -> str:
|
|
"""获取激活账号的API地址"""
|
|
return self.api_endpoints["activate"]
|
|
|
|
@property
|
|
def status_url(self) -> str:
|
|
"""获取状态检查的API地址"""
|
|
return self.api_endpoints["status"]
|
|
|
|
@property
|
|
def heartbeat_url(self) -> str:
|
|
"""获取心跳检测的API地址"""
|
|
return self.api_endpoints["heartbeat"]
|
|
|
|
@property
|
|
def request_kwargs(self) -> Dict:
|
|
"""获取请求配置"""
|
|
return self.request_config.copy()
|
|
|
|
# 创建全局配置实例
|
|
config = Config() |