A Python API client for the Modrinth API
Project description
modrinth4py
A Python API client for the Modrinth API.
Installation
pip install modrinth4py
Usage
from modrinth4py import ModrinthClient, NewProject, SideSupport, ProjectType
client = ModrinthClient(token="your-modrinth-pat")
project = client.get_project("sodium")
print(project["title"])
Creating a project
from modrinth4py import NewProject, SideSupport, ProjectType, RequestedStatus
new_project = NewProject(
slug="my-mod",
title="My Mod",
description="A short description",
categories=["utility"],
client_side=SideSupport.REQUIRED,
server_side=SideSupport.OPTIONAL,
body="## My Mod\nLong-form description here.",
project_type=ProjectType.MOD,
)
result = client.create_project(new_project)
Uploading a version
from pathlib import Path
from modrinth4py import NewVersion, VersionType
version = NewVersion(
name="1.0.0",
version_number="1.0.0",
project_id="your-id",
game_versions=["1.21"],
loaders=["fabric"],
version_type=VersionType.RELEASE,
changelog="Initial release.",
)
client.create_version(version, file_paths=[Path("my-mod-1.0.0.jar")])
Modifying a project
from modrinth4py import ModrinthClient, ProjectUpdate
client.modify_project("your-slug", ProjectUpdate(
discord_url="https://discord.gg/your-invite",
license_id="MIT",
))
Parallel requests
projects = ModrinthClient.parallel_requests([
lambda: client.get_project("sodium"),
lambda: client.get_project("lithium"),
lambda: client.get_project("iris"),
])
Logging
modrinth4py uses Python's standard logging module under the modrinth4py.client logger.
Pass debug=True to ModrinthClient to enable debug output, or configure your own handler:
import logging
logging.basicConfig(level=logging.DEBUG)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modrinth4py-0.0.2.tar.gz.
File metadata
- Download URL: modrinth4py-0.0.2.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0791822c4e3508bb1ec13a755dd1fbba42f7f72b7e137708c8cbf9d30c7dc293
|
|
| MD5 |
731af9f1b14374b429ef831f8f69da27
|
|
| BLAKE2b-256 |
5f64dc5deac2aea5baebd94fa1bbc56f24a5abb000f0d1e26a576fe3a499e7de
|
Provenance
The following attestation bundles were made for modrinth4py-0.0.2.tar.gz:
Publisher:
publish.yml on rotgruengelb/modrinth4py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modrinth4py-0.0.2.tar.gz -
Subject digest:
0791822c4e3508bb1ec13a755dd1fbba42f7f72b7e137708c8cbf9d30c7dc293 - Sigstore transparency entry: 1705306917
- Sigstore integration time:
-
Permalink:
rotgruengelb/modrinth4py@2b1f79c5be0ba31d20e3cb31061a049f4909993d -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/rotgruengelb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2b1f79c5be0ba31d20e3cb31061a049f4909993d -
Trigger Event:
push
-
Statement type:
File details
Details for the file modrinth4py-0.0.2-py3-none-any.whl.
File metadata
- Download URL: modrinth4py-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4efea8ae380722e842f43268a7ed00b706d2ba5e29ddc25e453e14f7321f4994
|
|
| MD5 |
96bb59317440715bafc0744f85c12955
|
|
| BLAKE2b-256 |
8e67565ae8ba09ec04e6484c49aeea8d5fe26a5bde8df399f6c31c17c97f6d12
|
Provenance
The following attestation bundles were made for modrinth4py-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on rotgruengelb/modrinth4py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modrinth4py-0.0.2-py3-none-any.whl -
Subject digest:
4efea8ae380722e842f43268a7ed00b706d2ba5e29ddc25e453e14f7321f4994 - Sigstore transparency entry: 1705306973
- Sigstore integration time:
-
Permalink:
rotgruengelb/modrinth4py@2b1f79c5be0ba31d20e3cb31061a049f4909993d -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/rotgruengelb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2b1f79c5be0ba31d20e3cb31061a049f4909993d -
Trigger Event:
push
-
Statement type: