mcarchive-api 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcarchive-api
3
+ Version: 0.1.0
4
+ Summary: Unofficial library to help you consume the MCArchive API
5
+ Keywords: minecraft,http,api,json
6
+ Author: 红温的鼠鼠7891
7
+ Author-email: 红温的鼠鼠7891 <pystart@qq.com>
8
+ License-Expression: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Dist: httpx>=0.28.1
13
+ Requires-Dist: urllib3>=2.8.0
14
+ Requires-Python: >=3.14
15
+ Description-Content-Type: text/markdown
16
+
17
+ # MCArchive API for Python
18
+
19
+ ## 简介
20
+
21
+ 这是一个允许开发者与MCArchive API交互的Python库,使用[`httpx`](https://pypi.org/project/httpx/)进行API交互,[`urllib`](https://pypi.org/project/urllib/)库作为变量转URL参数。
22
+
23
+ ## 安装
24
+
25
+ 通过`pip`包管理器安装:
26
+
27
+ ```bash
28
+ pip install mcarchive-api
29
+ poetry install mcarchive-api #或者使用Poetry
30
+ uv pip install mcarchive-api #或者使用uv
31
+ ```
32
+
33
+ 你也可以下载轮子并安装:
34
+
35
+ ```bash
36
+ pip install ./mcarchive_api-x.x.x-py3-none-any.whl
37
+ ```
38
+
39
+ 或者克隆Git仓库并构建轮子:
40
+
41
+ ```bash
42
+ git clone https://github.com/AngryMouse7891/mcarchive-api-python.git
43
+ cd mcarchive-api-python
44
+ uv build
45
+ ```
46
+
47
+ ## 使用方法
48
+
49
+ 以下是该库所有模块的描述:
50
+
51
+ - `mcarchive_api.default`:获取Minecraft游戏版本和作者
52
+
53
+ - `mcarchive_api.mods`:获取所有模组以及通过特定slug获取
54
+
55
+ - `mcarchive_api.files`:通过文件名/SHA256哈希值获取文件
56
+
57
+ 比如获取所有Minecraft游戏版本:
58
+
59
+ ```python
60
+ from mcarchive_api.default import get_game_versions
61
+
62
+ print(f'Game Versions: {get_game_versions()}')
63
+ ```
64
+
65
+ ## 使用的依赖
66
+
67
+ | 包名 | 最新版本 | 描述 |
68
+ | ------------------------------------------- | ------------------------------------------ | ------------------------- |
69
+ | [`httpx`](https://pypi.org/project/httpx) | ![latest](https://img.shields.io/pypi/v/httpx) | HTTP客户端 |
70
+ | [`urllib3`](https://pypi.org/project/httpx) | ![latest](https://img.shields.io/pypi/v/urllib3) | 带有线程安全连接池、文件上传等功能的 HTTP 库 |
71
+
72
+ ## 开源许可
73
+
74
+ 使用[MIT许可证](https://choosealicense.com/zh/licenses/mit/)。
@@ -0,0 +1,58 @@
1
+ # MCArchive API for Python
2
+
3
+ ## 简介
4
+
5
+ 这是一个允许开发者与MCArchive API交互的Python库,使用[`httpx`](https://pypi.org/project/httpx/)进行API交互,[`urllib`](https://pypi.org/project/urllib/)库作为变量转URL参数。
6
+
7
+ ## 安装
8
+
9
+ 通过`pip`包管理器安装:
10
+
11
+ ```bash
12
+ pip install mcarchive-api
13
+ poetry install mcarchive-api #或者使用Poetry
14
+ uv pip install mcarchive-api #或者使用uv
15
+ ```
16
+
17
+ 你也可以下载轮子并安装:
18
+
19
+ ```bash
20
+ pip install ./mcarchive_api-x.x.x-py3-none-any.whl
21
+ ```
22
+
23
+ 或者克隆Git仓库并构建轮子:
24
+
25
+ ```bash
26
+ git clone https://github.com/AngryMouse7891/mcarchive-api-python.git
27
+ cd mcarchive-api-python
28
+ uv build
29
+ ```
30
+
31
+ ## 使用方法
32
+
33
+ 以下是该库所有模块的描述:
34
+
35
+ - `mcarchive_api.default`:获取Minecraft游戏版本和作者
36
+
37
+ - `mcarchive_api.mods`:获取所有模组以及通过特定slug获取
38
+
39
+ - `mcarchive_api.files`:通过文件名/SHA256哈希值获取文件
40
+
41
+ 比如获取所有Minecraft游戏版本:
42
+
43
+ ```python
44
+ from mcarchive_api.default import get_game_versions
45
+
46
+ print(f'Game Versions: {get_game_versions()}')
47
+ ```
48
+
49
+ ## 使用的依赖
50
+
51
+ | 包名 | 最新版本 | 描述 |
52
+ | ------------------------------------------- | ------------------------------------------ | ------------------------- |
53
+ | [`httpx`](https://pypi.org/project/httpx) | ![latest](https://img.shields.io/pypi/v/httpx) | HTTP客户端 |
54
+ | [`urllib3`](https://pypi.org/project/httpx) | ![latest](https://img.shields.io/pypi/v/urllib3) | 带有线程安全连接池、文件上传等功能的 HTTP 库 |
55
+
56
+ ## 开源许可
57
+
58
+ 使用[MIT许可证](https://choosealicense.com/zh/licenses/mit/)。
@@ -0,0 +1,37 @@
1
+ [project]
2
+ name = "mcarchive-api"
3
+ version = "0.1.0"
4
+ description = "Unofficial library to help you consume the MCArchive API"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.14"
8
+ dependencies = [
9
+ "httpx>=0.28.1",
10
+ "urllib3>=2.8.0",
11
+ ]
12
+ classifiers = [
13
+ "Programming Language :: Python :: 3",
14
+ "License :: OSI Approved :: MIT License",
15
+ "Operating System :: OS Independent",
16
+ ]
17
+ keywords = [
18
+ "minecraft",
19
+ "http",
20
+ "api",
21
+ "json",
22
+ ]
23
+
24
+ [[project.authors]]
25
+ name = "红温的鼠鼠7891"
26
+ email = "pystart@qq.com"
27
+
28
+ [project.scripts]
29
+ mcarchive-api = "mcarchive_api:main"
30
+
31
+ [[tool.uv.index]]
32
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
33
+ default = true
34
+
35
+ [build-system]
36
+ requires = ["uv_build>=0.12.5,<0.13.0"]
37
+ build-backend = "uv_build"
@@ -0,0 +1,31 @@
1
+ [project]
2
+ name = "mcarchive-api"
3
+ version = "0.1.0"
4
+ description = "Unofficial library to help you consume the MCArchive API"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ authors = [
8
+ { name = "红温的鼠鼠7891", email = "pystart@qq.com" }
9
+ ]
10
+ requires-python = ">=3.14"
11
+ dependencies = [
12
+ "httpx>=0.28.1",
13
+ "urllib3>=2.8.0",
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent"
19
+ ]
20
+ keywords = ["minecraft", "http", "api", "json"]
21
+
22
+ [project.scripts]
23
+ mcarchive-api = "mcarchive_api:main"
24
+
25
+ [[tool.uv.index]]
26
+ url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
27
+ default = true
28
+
29
+ [build-system]
30
+ requires = ["uv_build>=0.12.5,<0.13.0"]
31
+ build-backend = "uv_build"
@@ -0,0 +1,4 @@
1
+ from importlib.metadata import version
2
+
3
+ def main() -> None:
4
+ print(f"mcarchive-api-python v{version("wheel")}")
@@ -0,0 +1,17 @@
1
+ import httpx
2
+
3
+ def get_authors(x_fields:str="{id,name}",headers:dict={"Accept":"application/json"}) -> list:
4
+ headers_1 = {
5
+ "X-Fields": x_fields,
6
+ }
7
+ headers_1.update(headers)
8
+ response=httpx.get("https://mcarchive.net/api/v1/authors",headers=headers_1)
9
+ return response.json()
10
+
11
+ def get_game_versions(x_fields:str="{id,name}",headers:dict={"Accept":"application/json"}) -> list:
12
+ headers_1 = {
13
+ "X-Fields": x_fields,
14
+ }
15
+ headers_1.update(headers)
16
+ response=httpx.get("https://mcarchive.net/api/v1/game_versions",headers=headers_1)
17
+ return response.json()
@@ -0,0 +1,17 @@
1
+ import httpx
2
+
3
+ def get_files_by_filename(filename:str,x_fields:str="{}",headers:dict={"Accept":"application/json"}) -> dict:
4
+ headers_1 = {
5
+ "X-Fields": x_fields,
6
+ }
7
+ headers_1.update(headers)
8
+ response=httpx.get("https://mcarchive.net/api/v1/files/by_filename/"+filename,headers=headers_1)
9
+ return response.json()
10
+
11
+ def get_files_by_hash_sha256(shasum:str,x_fields:str="{}",headers:dict={"Accept":"application/json"}) -> dict:
12
+ headers_1 = {
13
+ "X-Fields": x_fields,
14
+ }
15
+ headers_1.update(headers)
16
+ response=httpx.get("https://mcarchive.net/api/v1/files/by_hash/sha256/"+shasum,headers=headers_1)
17
+ return response.json()
@@ -0,0 +1,27 @@
1
+ import httpx
2
+ from urllib.parse import urlencode
3
+
4
+ def build_query(params: dict) -> str:
5
+ return "?" + urlencode(params)
6
+
7
+ def get_mods(keyword:str="",game_version:str="",author:str="",x_fields:str="{slug,name}",headers:dict={"Accept":"application/json"}) -> list:
8
+ headers_1 = {
9
+ "X-Fields": x_fields,
10
+ }
11
+ params = {
12
+ "keyword": keyword,
13
+ "game_version": game_version,
14
+ "author": author
15
+ }
16
+ query_str = build_query(params)
17
+ headers_1.update(headers)
18
+ response=httpx.get("https://mcarchive.net/api/v1/mods/"+query_str,headers=headers_1)
19
+ return response.json()
20
+
21
+ def get_mods_by_slug(slug:str,x_fields:str="{}",headers:dict={"Accept":"application/json"}) -> dict:
22
+ headers_1 = {
23
+ "X-Fields": x_fields,
24
+ }
25
+ headers_1.update(headers)
26
+ response=httpx.get("https://mcarchive.net/api/v1/mods/by_slug/"+slug,headers=headers_1)
27
+ return response.json()