I broke some code here but it's fine, implemented getLatestVersion_by_number

master
Chloe Fontenot 🏳️‍⚧️ 2022-03-16 19:22:47 +07:00
parent 0463ddc75f
commit 3412152ca3
2 changed files with 18 additions and 2 deletions

@ -7,6 +7,7 @@ import requests
from re import sub
import parsers.paperMC
import parsers.modrinth
import parsers.curseforge
import argparse
import shutil
import hashlib
@ -116,11 +117,26 @@ def modrinth(project, action, subAction):
download(project, parsers.modrinth.getLatestVersion(project))
#print(parsers.modrinth.getForMinecraftVersion(project, args.v))
# CurseForge command functions
def curseforge(project, action, subAction):
import json
if action == "get":
if subAction == "games":
print(parsers.curseforge.get_games())
if subAction == "mod":
print(json.dumps(parsers.curseforge.get_mod(project), indent=4))
if action == "search":
if subAction == "mod":
print(json.dumps(parsers.curseforge.search_mods(project), indent=4))
if action == "download":
if subAction == "latest":
print(parsers.curseforge.download(project))
# Determine which API parser to use:
if args.api == "paperMC":
paperMC(args.project, args.action, args.subAction)
elif args.api == "modrinth":
modrinth(args.project, args.action, args.subAction)
elif args.api == "curseforge":
curseforge(args.project, args.action, args.subAction)
else:
print("Error: Unknown API: "+args.api)

@ -19,7 +19,7 @@ if debug == True:
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
timeoutTime = 1
#Setup re
#regex = re.compile(r'*')
# Setup session, this lets the parser re-use the connection instead of establishing a new connection for EACH request, not only does this cause a HUGE performance boost, it's also nicer to the API.