Skip to main content

Mojang API Monitor

PyPI Python License

监控 Mojang API 各服务状态的 Python 库。当 Minecraft 玩家遇到登录错误时,可用此工具快速判断是否为 Mojang 服务器问题。

此项目是 Mojang-API-Monitor C# NuGet 包的 Python 移植版。

功能

  • 监控 9 个 Mojang 服务的在线状态
  • 支持并行检测,毫秒级完成全部检查
  • 自动 DNS 降级(部分服务 http 解析失败时自动尝试 https)
  • 支持 HTTP/HTTPS 代理
  • 支持自定义服务列表
  • 支持 JSON 序列化/反序列化
  • 提供命令行工具和 Python API 两种使用方式

监控的服务

# 服务名称 URL
1 Minecraft.net https://minecraft.net/
2 Session Minecraft http://session.minecraft.net/
3 Account Mojang http://account.mojang.com/
4 Auth Mojang https://auth.mojang.com/
5 Skins Minecraft http://skins.minecraft.net/
6 Authserver Mojang https://authserver.mojang.com/
7 Sessionserver Mojang https://sessionserver.mojang.com/
8 API Mojang https://api.mojang.com/
9 Textures Minecraft http://textures.minecraft.net/

安装

pip install mojang-api-monitor

使用

Python API

from mojang_api_monitor import MojangMonitor

# 创建监控器(支持代理)
monitor = MojangMonitor(
    proxies={"http": "http://127.0.0.1:7897", "https": "http://127.0.0.1:7897"}
)

# 检查所有服务(并行)
status = monitor.check_all_services()

# 遍历结果
for svc in status.services:
    print(f"{svc.name:20s} {svc.status:8s} {svc.response_time_ms:>6.0f}ms")

# 导出 JSON
print(status.to_dict())

命令行

# 基础检查
mojang-api-monitor

# 使用代理
mojang-api-monitor --proxy-http http://127.0.0.1:7897

# 导出 JSON
mojang-api-monitor -o status.json

# 自定义超时和并发
mojang-api-monitor -t 15 -w 5

JSON 输出格式

{
  "services": [
    {
      "name": "Minecraft.net",
      "url": "https://minecraft.net/",
      "display_url": "https://minecraft.net",
      "status": "ONLINE",
      "last_checked": "2025-05-29T16:41:41.0165483Z",
      "response_time_ms": 3249.0
    }
  ],
  "timestamp": "2025-05-29T16:41:37.7543238Z"
}

开发

# 克隆
git clone https://github.com/PCL-Community/Mojang-API-Monitor.git
cd Mojang-API-Monitor

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试
pytest

# 构建
python -m build

依赖

  • Python >= 3.8
  • requests >= 2.25

许可证

MIT License

免责声明

本项目不隶属于 Mojang Studios 或 Microsoft。Minecraft、Mojang 是 Mojang Studios 的商标。

Metadata

Release files for mojang-api-monitor 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mojang-api-monitor 1.0.1
File Size Uploaded
mojang_api_monitor-1.0.1.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mojang-api-monitor 1.0.1
File Interpreter ABI Platform
mojang_api_monitor-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / mojang_api_monitor-1.0.1.tar.gz

Download URL mojang_api_monitor-1.0.1.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d05e194b3fb2c7629b7c49e3df3e4067c397d81c50b4f63af86ca8cf8f7c3f2c
BLAKE2b-256 checksum
How to use checksums
30c7b6f4396b7064bdb4a2ac2ad1c71931f15828b353cdec87ce9ea28e3b6828
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / mojang_api_monitor-1.0.1-py3-none-any.whl

Download URL mojang_api_monitor-1.0.1-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48ecc9912ed5fefe116ff3037f2502020e48e60a14cc7315c7b85985f49261bd
BLAKE2b-256 checksum
How to use checksums
4e148f6c29be32494355dfbbd6296b10928e79318681bfd9abec77f52f6b3fec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page