trackerstatus
v0.2.0
一个用于与TrackerStatus.info API互动的Python库。 TrackerStatus.info为各种跟踪器提供实时状态更新和历史数据,可帮助用户监视和分析跟踪器的性能。
pip install trackerstatuspoetry add trackerstatus首先,您需要初始化要使用的Apiclient和特定端点类。
from trackerstatus . core import APIClient
from trackerstatus . endpoints . btn import BTNEndpoint
from trackerstatus . endpoints . status import StatusEndpoint
# Initialize the APIClient
client = APIClient ( base_url = 'https://btn.trackerstatus.info' )
# Initialize the BTN endpoint
btn_api = BTNEndpoint ( client = client )
# Initialize the Status endpoint
status_api = StatusEndpoint ( client = client ) statuses = status_api . get_tracker_statuses ()
print ( statuses )为了获得所有BTN服务的状态:
status = btn_api . get_btn_status ()
print ( "Status:" , status )为了获得所有BTN服务的延迟:
latency = btn_api . get_btn_latency ()
print ( "Latency:" , latency )为了获得所有BTN服务的当前正常运行时间:
uptime = btn_api . get_btn_uptime ()
print ( "Uptime:" , uptime )为了获得所有BTN服务的最佳正常运行时间:
records = btn_api . get_btn_records ()
print ( "Records:" , records )为了获得所有BTN服务的当前停机时间:
downtime = btn_api . get_btn_downtime ()
print ( "Downtime:" , downtime )要获取BTN服务的所有合并数据,包括状态,延迟,正常运行时间,记录和停机时间:
all_data = btn_api . get_btn_all ()
print ( "All Data:" , all_data )要获得所有跟踪器的状态:
tracker_statuses = status_api . get_tracker_statuses ()
print ( "Tracker Statuses:" , tracker_statuses )要运行测试,您可以使用pytest。确保您安装了所有开发依赖性:
poetry install
poetry shell
pytest