Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modrinth4py-0.0.3.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modrinth4py-0.0.3-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file modrinth4py-0.0.3.tar.gz.

File metadata

  • Download URL: modrinth4py-0.0.3.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

Hashes for modrinth4py-0.0.3.tar.gz
Algorithm Hash digest
SHA256 526b11d8ce8f978fcf015e2f0dc38ab321024ef9bf846b0711e02c6f65476538
MD5 cef76bfb92a04066fa910ce8fd984dfb
BLAKE2b-256 2c8c8615602b6fb5e379a31455c1040282468e9c68d3917334505b2c9e01544d

See more details on using hashes here.

Provenance

The following attestation bundles were made for modrinth4py-0.0.3.tar.gz:

Publisher: publish.yml on rotgruengelb/modrinth4py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modrinth4py-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: modrinth4py-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modrinth4py-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ab918ffb51008db53e969703cfb03499817152b85cd7885821c18a32a07618ea
MD5 b8c683327d1967bd0c9feac9b9c6c563
BLAKE2b-256 a50fd895ac1e613c1cc99bbbf3ab47f1a51f17518a65592a29d3810eb87808e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for modrinth4py-0.0.3-py3-none-any.whl:

Publisher: publish.yml on rotgruengelb/modrinth4py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page