modrinth


Namemodrinth JSON
Version 0.1.5 PyPI version JSON
download
home_page
SummaryInteract with Modrinth's Labrinth API through Python.
upload_time2023-07-16 22:28:45
maintainer
docs_urlNone
author
requires_python>=3.9
licenseThe MIT License (MIT) ===================== Copyright © `2020` `Daniel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords minecraft modrinth modrinth-api labrinth
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Modrinth.py
Interact with Modrinth's Labrinth API through Python. 

## To-do
 - [x] Search for projects
 - [x] (Un)follow projects
 - [x] Basic authentication
 - [ ] Documentation
 - [ ] Create and delete projects
 - [ ] Modify projects (PATCH requests to `/project/{id|slug}` and `/project/{id|slug}/gallery` requests)
 - [x] Built-in function to get multiple projects at once
 - [ ] Project dependencies management
 - [x] Get project versions
 - [x] Get project details
 - [ ] Create, modify, and delete projects (POST requests to `/version` and PATCH/DELETE to `/version/{id}`)
 - [x] Built-in function to get multiple versions
 - [ ] Upload files to version
 - [ ] Get a version from `sha1` or `sha512`
 - [ ] Delete a file from its hash (DELETE requests to `/version_file`)
 - [x] Get latest project(s) version(s)
 - [ ] Get project version from hash
 - [x] Read user(s) data
 - [ ] Delete and modify user data
 - [ ] Read team data 
 - [ ] Add users to teams
 - [ ] Join a team
 - [ ] Modify user roles/perms within a team
 - [ ] Remove user(s) from a team
 - [ ] Change team owner
 - [ ] Get categories, mod loaders, game versions, licenses, donation sites, and report types. ("tags")
 - [ ] Support for more branches (ie. staging)



## API Documentation

### Usage
#### Through pip
```bash
pip install modrinth
```
View the project page on [GitHub](https://github.com/BetaPictoris/modrinth.py) or [pip](https://pypi.org/project/modrinth/)

### Users (`Users`)
User data includes their username, name, email, bio, etc. this class hold functions and objects that relate
to authentication and user data.  

Authentication is done using a GitHub token, in the request header. Modrinth.py will automatically add
the token to the request header and Labrinth's documentation says that the token is required for these
requests: 
 - those which create data (such as version creation)
 - those which modify data (such as editing a project)
 - those which access private data (such as draft projects and notifications)

For more information, see: https://docs.modrinth.com/api-spec/#section/Authentication

#### User 
```python
user = modrinth.Users.ModrinthUser('yyy') # Find a user with the username/ID yyy

print(user.name)  # Print the user's name
```

#### Authentication
```python
authedUser = modrinth.Users.AuthenticatedUser('ghp_xxx') # GitHub token

# After authentication we can interact with projects, such as following and unfollowing a mod.
project = modrinth.Projects.ModrinthProject('zzz')
project.unfollow(authedUser)
```

## Getting project information
### Projects (`Projects`)
The `Projects` class is used to interact with projects. These interactions include getting a project from slug/ID, searching for projects, and (un)following a project. With more projects being planned, this class will be expanded. Projects are mods and modpacks.

#### Searching for projects
```python
projects = modrinth.Projects.Search('mod')
print(projects.hits[0].name) # Prints the name of the first project found
```

#### Get project from slug/ID
```python
project = modrinth.Projects.ModrinthProject('zzz')
print(project.name) # Prints the name of the project
```

## Getting version information
### Versions (`Versions`)
The `Versions` class is used to interact with versions. It currently can only get version information, such as downloads and files. 
#### Get version information
The suggested way to get a version is through the `Project.ModrinthProject.getVersion()` shorthand, although you can also use the `Versions.ModrinthVersion` class directly.
```python
project = modrinth.Projects.ModrinthProject('zzz') # Get a project from slug/ID
version = project.getVersion('aaa111bb')           # Get the version with ID 'aaa111bb'

primaryFile = version.getPrimaryFile()  # Returns the hash of the primary file
print(version.getDownload(primaryFile)) # Returns the download URL of the primary file
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "modrinth",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "minecraft,modrinth,modrinth-api,labrinth",
    "author": "",
    "author_email": "Beta Pictoris <beta@ozx.me>",
    "download_url": "https://files.pythonhosted.org/packages/95/3c/afa6d8216a25bd6e17a9c7fd1f061b79890910c18831b89987795577a48b/modrinth-0.1.5.tar.gz",
    "platform": null,
    "description": "# Modrinth.py\nInteract with Modrinth's Labrinth API through Python. \n\n## To-do\n - [x] Search for projects\n - [x] (Un)follow projects\n - [x] Basic authentication\n - [ ] Documentation\n - [ ] Create and delete projects\n - [ ] Modify projects (PATCH requests to `/project/{id|slug}` and `/project/{id|slug}/gallery` requests)\n - [x] Built-in function to get multiple projects at once\n - [ ] Project dependencies management\n - [x] Get project versions\n - [x] Get project details\n - [ ] Create, modify, and delete projects (POST requests to `/version` and PATCH/DELETE to `/version/{id}`)\n - [x] Built-in function to get multiple versions\n - [ ] Upload files to version\n - [ ] Get a version from `sha1` or `sha512`\n - [ ] Delete a file from its hash (DELETE requests to `/version_file`)\n - [x] Get latest project(s) version(s)\n - [ ] Get project version from hash\n - [x] Read user(s) data\n - [ ] Delete and modify user data\n - [ ] Read team data \n - [ ] Add users to teams\n - [ ] Join a team\n - [ ] Modify user roles/perms within a team\n - [ ] Remove user(s) from a team\n - [ ] Change team owner\n - [ ] Get categories, mod loaders, game versions, licenses, donation sites, and report types. (\"tags\")\n - [ ] Support for more branches (ie. staging)\n\n\n\n## API Documentation\n\n### Usage\n#### Through pip\n```bash\npip install modrinth\n```\nView the project page on [GitHub](https://github.com/BetaPictoris/modrinth.py) or [pip](https://pypi.org/project/modrinth/)\n\n### Users (`Users`)\nUser data includes their username, name, email, bio, etc. this class hold functions and objects that relate\nto authentication and user data.  \n\nAuthentication is done using a GitHub token, in the request header. Modrinth.py will automatically add\nthe token to the request header and Labrinth's documentation says that the token is required for these\nrequests: \n - those which create data (such as version creation)\n - those which modify data (such as editing a project)\n - those which access private data (such as draft projects and notifications)\n\nFor more information, see: https://docs.modrinth.com/api-spec/#section/Authentication\n\n#### User \n```python\nuser = modrinth.Users.ModrinthUser('yyy') # Find a user with the username/ID yyy\n\nprint(user.name)  # Print the user's name\n```\n\n#### Authentication\n```python\nauthedUser = modrinth.Users.AuthenticatedUser('ghp_xxx') # GitHub token\n\n# After authentication we can interact with projects, such as following and unfollowing a mod.\nproject = modrinth.Projects.ModrinthProject('zzz')\nproject.unfollow(authedUser)\n```\n\n## Getting project information\n### Projects (`Projects`)\nThe `Projects` class is used to interact with projects. These interactions include getting a project from slug/ID, searching for projects, and (un)following a project. With more projects being planned, this class will be expanded. Projects are mods and modpacks.\n\n#### Searching for projects\n```python\nprojects = modrinth.Projects.Search('mod')\nprint(projects.hits[0].name) # Prints the name of the first project found\n```\n\n#### Get project from slug/ID\n```python\nproject = modrinth.Projects.ModrinthProject('zzz')\nprint(project.name) # Prints the name of the project\n```\n\n## Getting version information\n### Versions (`Versions`)\nThe `Versions` class is used to interact with versions. It currently can only get version information, such as downloads and files. \n#### Get version information\nThe suggested way to get a version is through the `Project.ModrinthProject.getVersion()` shorthand, although you can also use the `Versions.ModrinthVersion` class directly.\n```python\nproject = modrinth.Projects.ModrinthProject('zzz') # Get a project from slug/ID\nversion = project.getVersion('aaa111bb')           # Get the version with ID 'aaa111bb'\n\nprimaryFile = version.getPrimaryFile()  # Returns the hash of the primary file\nprint(version.getDownload(primaryFile)) # Returns the download URL of the primary file\n```\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT) =====================  Copyright \u00a9 `2020` `Daniel`  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Interact with Modrinth's Labrinth API through Python.",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/BetaPictoris/modrinth.py"
    },
    "split_keywords": [
        "minecraft",
        "modrinth",
        "modrinth-api",
        "labrinth"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "78b542eaa53bef8b132c2a242486d77cb79e691382cbb06adab923b7f0181013",
                "md5": "d2bca1647d746db7083297b323660374",
                "sha256": "a7741815448a82e0c376656be0811ba73691e3d8e17d12eba159caf1151fd3ec"
            },
            "downloads": -1,
            "filename": "modrinth-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d2bca1647d746db7083297b323660374",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7033,
            "upload_time": "2023-07-16T22:28:44",
            "upload_time_iso_8601": "2023-07-16T22:28:44.194596Z",
            "url": "https://files.pythonhosted.org/packages/78/b5/42eaa53bef8b132c2a242486d77cb79e691382cbb06adab923b7f0181013/modrinth-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "953cafa6d8216a25bd6e17a9c7fd1f061b79890910c18831b89987795577a48b",
                "md5": "fe61bb7b6132169e9dddfb0683c1200c",
                "sha256": "42f21585311be1422ca89a4aee2acf024fbea6edbfd9f2a10f74861029844cdd"
            },
            "downloads": -1,
            "filename": "modrinth-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "fe61bb7b6132169e9dddfb0683c1200c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 7247,
            "upload_time": "2023-07-16T22:28:45",
            "upload_time_iso_8601": "2023-07-16T22:28:45.805260Z",
            "url": "https://files.pythonhosted.org/packages/95/3c/afa6d8216a25bd6e17a9c7fd1f061b79890910c18831b89987795577a48b/modrinth-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-16 22:28:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BetaPictoris",
    "github_project": "modrinth.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "modrinth"
}
        
Elapsed time: 0.09106s