@ -24,7 +24,7 @@ if debug == True:
#regex = re.compile(r'*')
#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.
# 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.
session = requests . Session ( )
session = requests . Session ( )
base_api_url = " https://api.modrinth.com:443/ api/v1 "
base_api_url = " https://api.modrinth.com:443/ v2 "
def failCheck ( response , functOrigin ) :
def failCheck ( response , functOrigin ) :
print ( " Status Code is: " + str ( response . status_code ) )
print ( " Status Code is: " + str ( response . status_code ) )
if response . status_code == 429 :
if response . status_code == 429 :
@ -50,7 +50,7 @@ def modInfo(project):
print ( " Returning cached data! " )
print ( " Returning cached data! " )
return dataCache [ " modInfo " ]
return dataCache [ " modInfo " ]
else :
else :
response = session . get ( base_api_url + " / mod /" + project , family = socket . AF_INET )
response = session . get ( base_api_url + " / project /" + project , family = socket . AF_INET )
if failCheck ( response , " modInfo " ) == True : #Attempt to requery API
if failCheck ( response , " modInfo " ) == True : #Attempt to requery API
response = session . get ( base_api_url + " /mod/ " + project , family = socket . AF_INET )
response = session . get ( base_api_url + " /mod/ " + project , family = socket . AF_INET )
api_response = response . json ( )
api_response = response . json ( )
@ -220,6 +220,7 @@ def getLatestStable(project):
print ( " Calling getLatestStable()... " )
print ( " Calling getLatestStable()... " )
versions = getVersions ( project )
versions = getVersions ( project )
build_type = determine ( project , " Release " )
build_type = determine ( project , " Release " )
# Build a dictionary that ties the versions to the build type
# Build a dictionary that ties the versions to the build type
build_type_dict = { }
build_type_dict = { }
number_of_versions = len ( versions )
number_of_versions = len ( versions )