-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule_get_project.py
53 lines (44 loc) · 1.73 KB
/
module_get_project.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import requests
import module_task_processing
def IEc(project_idorslug):
try:
gets = requests.get("https://api.modrinth.com/v2/project/{0}/check".format(project_idorslug))
except requests.exceptions.ConnectionError:
return "Error"
if gets.status_code==200:
return True
else:
return False
def IEg(project_idorslug):
try:
gets = requests.get("https://api.modrinth.com/v2/project/{0}".format(project_idorslug))
except requests.exceptions.ConnectionError:
return False
return gets.json()
def IGd(gets_json):
if gets_json is None:
return None
info = [gets_json['title'], gets_json['description'], gets_json['project_type'], gets_json['client_side'],
gets_json['server_side'], gets_json['downloads'], gets_json['followers'], gets_json['body'],
gets_json['license']['id'], gets_json['game_versions'], gets_json['loaders'], gets_json['issues_url'],
gets_json['source_url'], gets_json['wiki_url'], gets_json['discord_url'], gets_json['donation_urls'],
gets_json['slug']]
return info
def IEs(query, facets, index):
gurl = "https://api.modrinth.com/v2/search?query={0}&limit=30".format(query)
if len(facets)!=0:
gurl = gurl + "&{0}".format(module_task_processing.cURL(facets))
try:
gets = requests.get(gurl)
except requests.exceptions.ConnectionError:
return None
a = gets.json()
return gets.json()
def IEs_Gfl(f_list, f_name):
if len(f_list)==1:
return "empty"
ver_f = list()
for i in f_list:
if i!="q":
ver_f.append("{0}:{1}".format(f_name, i))
return ver_f