Compare commits
2
Commits
develoment
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03d2d96e90 | ||
|
|
999899ab3c |
@@ -1,7 +0,0 @@
|
|||||||
dist/
|
|
||||||
|
|
||||||
__pycache__/
|
|
||||||
|
|
||||||
src/macaronipm/__pycache__
|
|
||||||
|
|
||||||
src/test.py
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2026 KoffeeJava
|
|
||||||
|
|
||||||
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.
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
# MacaroniPM | A PenguinMod API wrapper
|
|
||||||
|
|
||||||
## Instalation
|
|
||||||
|
|
||||||
You can download the latest version of macaronipm via `pip install macaronipm`
|
|
||||||
|
|
||||||
## New functions
|
|
||||||
|
|
||||||
`macaronipm.user.UserExist()`
|
|
||||||
|
|
||||||
`macaronipm.user.IsBanned()`
|
|
||||||
|
|
||||||
`macaronipm.user.logout()`
|
|
||||||
|
|
||||||
`macaronipm.user.GetMessages()`
|
|
||||||
|
|
||||||
`macaronipm.user.getUnreadMessages()`
|
|
||||||
|
|
||||||
`macaronipm.IsOnline()`
|
|
||||||
|
|
||||||
`macaronipm.project.hasLovedVoted()`
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
[build-system]
|
|
||||||
requires = ["uv_build >= 0.9.26, <0.10.0"]
|
|
||||||
build-backend = "uv_build"
|
|
||||||
|
|
||||||
[project]
|
|
||||||
name = "macaronipm"
|
|
||||||
version = "3.0.0"
|
|
||||||
authors = [
|
|
||||||
{ name="KoffeeJava", email="koffeejava@tuta.io" },
|
|
||||||
]
|
|
||||||
description = "A PenguinMod API Wrapper"
|
|
||||||
readme = "README.md"
|
|
||||||
requires-python = ">=3.9"
|
|
||||||
classifiers = [
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Operating System :: OS Independent",
|
|
||||||
]
|
|
||||||
license = "MIT"
|
|
||||||
license-files = ["LICEN[CS]E*"]
|
|
||||||
|
|
||||||
[project.urls]
|
|
||||||
Homepage = "https://www.koffeejava.us/macaroni"
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import requests
|
|
||||||
from . import misc
|
|
||||||
from . import project
|
|
||||||
from . import user
|
|
||||||
|
|
||||||
def isOnline():
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/ping"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def ddededodediamante():
|
|
||||||
print("ddededodediamante mode on")
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import json
|
|
||||||
from colorist import Color
|
|
||||||
from colorist import Effect
|
|
||||||
from colorist import ColorHex
|
|
||||||
|
|
||||||
ORANGE = ColorHex("#ff8800")
|
|
||||||
|
|
||||||
def rerror(code, jsonr):
|
|
||||||
error_ = json.loads(jsonr.decode())["error"]
|
|
||||||
|
|
||||||
print(f"{Color.RED}MacaroniPM: An error has occured!")
|
|
||||||
print(f"Status code: {code}")
|
|
||||||
print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{error_}{Effect.OFF}")
|
|
||||||
|
|
||||||
if error_ == "Project not found":
|
|
||||||
print(f"{ORANGE}{Effect.BOLD}Hint: Try checking to see if the PID is correct!{Effect.OFF}")
|
|
||||||
elif error_ == "NotFound":
|
|
||||||
print(f"{ORANGE}{Effect.BOLD}Hint: Try checking to see if the username is correct{Effect.OFF}")
|
|
||||||
elif error_ == "Reauthenticate":
|
|
||||||
print(f"{ORANGE}{Effect.BOLD}Hint: Try checking to see if the token is correct or try to get a new token.{Effect.OFF}")
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
from. import error
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
from colorist import Effect
|
|
||||||
from colorist import ColorHex
|
|
||||||
|
|
||||||
ORANGE = ColorHex("#ff8800")
|
|
||||||
|
|
||||||
def setToken(settoken):
|
|
||||||
global TOKEN
|
|
||||||
TOKEN = settoken
|
|
||||||
|
|
||||||
def setProject(projectid):
|
|
||||||
global PID
|
|
||||||
PID = projectid
|
|
||||||
|
|
||||||
def follow(target, toggle):
|
|
||||||
url = "https://projects.penguinmod.com/api/v1/users/follow"
|
|
||||||
|
|
||||||
data = f'{{"token":"{TOKEN}","target":"{target}","toggle":{toggle}}}'
|
|
||||||
headers = {'Content-type': 'application/json'}
|
|
||||||
response = requests.post(url, headers=headers, data=data)
|
|
||||||
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def getFeatured():
|
|
||||||
print(f"{ORANGE}MacaroniPM: The featured function is stil being worked on. It is recomended {Effect.BOLD}{Effect.UNDERLINE}NOT{Effect.OFF}{ORANGE} to use this.{Effect.OFF}")
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/projects/searchprojects?page=0&query=&type=featured&token={TOKEN}&reverse=false"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return response.text.split()
|
|
||||||
|
|
||||||
def getStats():
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/misc/getStats"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return json.loads(response.content)
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
from . import misc
|
|
||||||
from. import error
|
|
||||||
import io
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
import base64
|
|
||||||
|
|
||||||
def getThumbnail():
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/projects/getproject?projectID={misc.PID}&requestType=thumbnail"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
base64_data = base64.b64encode(io.BytesIO(response.content).read()).decode('utf-8')
|
|
||||||
return f"data:image/jpeg;base64,{base64_data}"
|
|
||||||
|
|
||||||
def getMeta():
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/projects/getproject?projectID={misc.PID}&requestType=metadata"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return json.loads(response.content)
|
|
||||||
|
|
||||||
def loveToggle(toggle):
|
|
||||||
url = "https://projects.penguinmod.com/api/v1/projects/interactions/loveToggle"
|
|
||||||
|
|
||||||
data = f'{{"projectId":"{misc.PID}","token":"{misc.TOKEN}","toggle":{toggle}}}'
|
|
||||||
headers = {'Content-type': 'application/json'}
|
|
||||||
response = requests.post(url, headers=headers, data=data)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def voteToggle(toggle):
|
|
||||||
url = "https://projects.penguinmod.com/api/v1/projects/interactions/voteToggle"
|
|
||||||
|
|
||||||
data = f'{{"projectId":"{misc.PID}","token":"{misc.TOKEN}","toggle":{toggle}}}'
|
|
||||||
headers = {'Content-type': 'application/json'}
|
|
||||||
response = requests.post(url, headers=headers, data=data)
|
|
||||||
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def getRankedProjects(page):
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/projects/getprojects?page={page}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return json.loads(response.content)
|
|
||||||
|
|
||||||
def hasLovedVoted():
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/projects/getuserstatewrapper?projectId={misc.PID}&token={misc.TOKEN}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return json.loads(response.content)
|
|
||||||
|
|
||||||
def getFrontpage():
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/projects/frontpage"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return json.loads(response.content)
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
from . import misc
|
|
||||||
from . import error
|
|
||||||
import io
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
import base64
|
|
||||||
|
|
||||||
def getMeta(target):
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/users/profile?target={target}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return json.loads(response.content)
|
|
||||||
|
|
||||||
def isBlocking(target):
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/users/hasblocked?target={target}&token={misc.TOKEN}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
jsons = json.loads(response.content.decode())
|
|
||||||
return jsons['has_blocked']
|
|
||||||
|
|
||||||
def getPfp(target):
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/users/getpfp?username={target}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
base64_data = base64.b64encode(io.BytesIO(response.content).read()).decode('utf-8')
|
|
||||||
return f"data:image/jpeg;base64,{base64_data}"
|
|
||||||
|
|
||||||
def userExist(target):
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/users/userexists?username={target}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
|
|
||||||
return json.loads(response.content)['exists']
|
|
||||||
|
|
||||||
def isBanned(target):
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/users/isBanned?username={target}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
|
|
||||||
return json.loads(response.content)['isBanned']
|
|
||||||
|
|
||||||
def logout():
|
|
||||||
url = "https://projects.penguinmod.com/api/v1/users/logout"
|
|
||||||
|
|
||||||
data = f'{{"token":"{misc.TOKEN}"}}'
|
|
||||||
headers = {'Content-type': 'application/json'}
|
|
||||||
response = requests.post(url, headers=headers, data=data)
|
|
||||||
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def getMessages():
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/users/getmessages?token={misc.TOKEN}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
jsons = json.loads(response.content.decode())
|
|
||||||
return jsons
|
|
||||||
|
|
||||||
def getUnreadMessages():
|
|
||||||
url = f"https://projects.penguinmod.com/api/v1/users/getunreadmessages?token={misc.TOKEN}"
|
|
||||||
|
|
||||||
response = requests.get(url)
|
|
||||||
|
|
||||||
if not response.status_code == 200:
|
|
||||||
error.rerror(response.status_code, response.content)
|
|
||||||
return -1
|
|
||||||
|
|
||||||
jsons = json.loads(response.content.decode())
|
|
||||||
return jsons
|
|
||||||
Reference in New Issue
Block a user