-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvapi.py
226 lines (194 loc) · 9.23 KB
/
svapi.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
import requests
import json
session = requests.Session()
session.trust_env = False
# USER
def GetUserDataFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/User/GetUser?SVID={SVID}").text
if "Could not find" in result:
raise Exception("GetUser: Param(s) are invalid.")
else:
return json.loads(result)
def GetUsernameFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/User/GetUsername?SVID={SVID}").text
if "Could not find" in result:
raise Exception("GetUsername: Param(s) are invalid.")
else:
return result
def GetSVIDFromUsername(username):
result = requests.get(f"https://api.spookvooper.com/User/GetSVIDFromUsername?username={username}").text
if "Could not find" in result:
raise Exception("GetSVIDFromUsername: Param(s) are invalid.")
else:
return result
def GetUsernameFromDiscord(discordid):
result = requests.get(f"https://api.spookvooper.com/User/GetUsernameFromDiscord?discordid={discordid}").text
if "Could not find" in result:
raise Exception("GetUsernameFromDiscord: Param(s) are invalid.")
else:
return result
def GetSVIDFromDiscord(discordid):
result = requests.get(f"https://api.spookvooper.com/User/GetSVIDFromDiscord?discordid={discordid}").text
if "Could not find" in result:
raise Exception("GetSVIDFromDiscord: Param(s) are invalid.")
else:
return result
def GetUsernameFromMinecraft(minecraftid):
result = requests.get(f"https://api.spookvooper.com/User/GetUsernameFromMinecraft?minecraftid={minecraftid}").text
if "Could not find" in result:
raise Exception("GetUsernameFromMinecraft: Param(s) are invalid.")
else:
return result
def GetSVIDFromMinecraft(minecraftid):
result = requests.get(f"https://api.spookvooper.com/User/GetSVIDFromMinecraft?minecraftid={minecraftid}").text
if "Could not find" in result:
raise Exception("GetSVIDFromMinecraft: Param(s) are invalid.")
else:
return result
def HasDiscordRoleFromSVIDandRole(SVID, role):
result = requests.get(f"https://api.spookvooper.com/User/HasDiscordRole?userid={SVID}&role={role}").text
if "Could not find" in result:
raise Exception("HasDiscordRoleFromSVID: Param(s) are invalid.")
else:
return json.loads(result)
def GetDiscordRolesFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/User/HasDiscordRole?SVID={SVID}").text
if "Could not find" in result:
raise Exception("GetDiscordRolesFromSVID: Param(s) are invalid.")
else:
return json.loads(result)
def GetDiscordIdFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/User/GetUser?SVID={SVID}").text
if "Could not find" in result:
raise Exception("GetDiscordRolesFromSVID: Param(s) are invalid.")
else:
data = json.loads(result)
discordid = data["discord_id"]
return discordid
def GetDaysSinceLastMoveFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/User/GetDaysSinceLastMove?SVID={SVID}").text
if "Could not find" in result:
raise Exception("GetDaysSinceLastMoveFromSVID: Param(s) are invalid.")
else:
return json.loads(result)
def GetSenators():
result = requests.get("https://api.spookvooper.com/User/GetSenators").text
return result
# GROUP
def DoesGroupExistFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/Group/DoesGroupExist?svid={SVID}").text
if "Could not find" in result:
raise Exception("DoesGroupExistFromSVID: Param(s) are invalid.")
else:
return json.loads(result)
def GetGroupMembersFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/Group/GetGroupMembers?svid={SVID}").text
if "Could not find" in result:
raise Exception("GetGroupMembersFromSVID: Param(s) are invalid.")
else:
return json.loads(result)
def HasGroupPermissionFromSVIDandUserSVIDandPermission(SVID, userSVID, permission):
result = requests.get(f"https://api.spookvooper.com/Group/HasGroupPermission?svid={SVID}&userSVID={userSVID}&permission={permission}").text
if "Could not find" in result:
raise Exception("HasGroupPermissionFromSVIDandUserSVIDandPermission: Param(s) are invalid.")
else:
return json.loads(result)
def GetSVIDFromGroupname(groupname):
result = requests.get(f"https://api.spookvooper.com/Group/GetSVIDFromName?name={groupname}").text
if "Could not find" in result:
raise Exception("GetSVIDFromGroupname: Param(s) are invalid.")
else:
return json.loads(result)
def GetGroupnameFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/Group/GetName?svid={SVID}").text
if "Could not find" in result:
raise Exception("GetName: Param(s) are invalid.")
else:
return json.loads(result)
# ECO
def GetBalanceFromSVID(SVID):
result = requests.get(f"https://api.spookvooper.com/Eco/GetBalance?svid={SVID}").text
if "Could not find" in result:
raise Exception("GetBalanceFromSVID: Param(s) are invalid.")
else:
return json.loads(result)
def SendTransactionByIDs(sender_svid, receiver_svid, amount, auth, detail):
result = requests.get(f"https://api.spookvooper.com/Eco/SendTransactionByIDs?from={sender_svid}&to={receiver_svid}&amount={amount}&auth={auth}&detail={detail}").text
if "Could not find" in result:
raise Exception("SendTransactionByIDs: Param(s) are invalid.")
else:
return json.loads(result)
def GetStockValueFromTicker(ticker):
result = requests.get(f"https://api.spookvooper.com/Eco/GetStockValueFromTicker?ticker={ticker}").text
if "Could not find" in result:
raise Exception("GetStockValueFromTicker: Param(s) are invalid.")
else:
return json.loads(result)
def GetStockHistory(ticker, time_type, count, interval):
if count > 60:
raise Exception("GetStockHistory: Count must not be greater than 60.")
result = requests.get(f"https://api.spookvooper.com/Eco/GetStockHistory?ticker={ticker}&type={time_type}&count={count}&interval={interval}").text
if "Could not find" in result:
raise Exception("GetStockHistory: Param(s) are invalid.")
else:
return json.loads(result)
def SubmitStockBuy(ticker, count, price, accountid, auth):
result = requests.get(f"https://api.spookvooper.com/Eco/SubmitStockBuy?ticker={ticker}&count={count}&price={price}&accountid={accountid}&auth={auth}").text
if "Could not find" in result:
raise Exception("SubmitStockBuy: Param(s) are invalid.")
else:
return json.loads(result)
def SubmitStockSell(ticker, count, price, accountid, auth):
result = requests.get(f"https://api.spookvooper.com/Eco/SubmitStockSell?ticker={ticker}&count={count}&price={price}&accountid={accountid}&auth={auth}").text
if "Could not find" in result:
raise Exception("SubmitStockSell: Param(s) are invalid.")
else:
return json.loads(result)
def CancelOrder(orderid, accountid, auth):
result = requests.get(f"https://api.spookvooper.com/Eco/CancelOrder?orderid={orderid}&accountid={accountid}&auth={auth}").text
if "Could not find" in result:
raise Exception("CancelOrder: Param(s) are invalid.")
else:
return json.loads(result)
def GetStockBuyPrice(ticker):
result = requests.get(f"https://api.spookvooper.com/Eco/GetStockBuyPrice?ticker={ticker}").text
if "Could not find" in result:
raise Exception("GetStockBuyPrice: Param(s) are invalid.")
else:
return json.loads(result)
def GetQueueInfo(ticker, action_type):
result = requests.get(f"https://api.spookvooper.com/Eco/GetQueueInfo?ticker={ticker}&type={action_type}").text
if "Could not find" in result:
raise Exception("GetQueueInfo: Param(s) are invalid.")
else:
return json.loads(result)
def GetUserStockOffers(ticker, SVID):
result = requests.get(f"https://api.spookvooper.com/Eco/GetUserStockOffers?ticker={ticker}&svid={SVID}").text
if "Could not find" in result:
raise Exception("GetUserStockOffers: Param(s) are invalid.")
else:
return json.loads(result)
def GetDistrictWealth(district_name):
result = requests.get(f"https://api.spookvooper.com/Eco/GetDistrictWealth?id={district_name}").text
if "Could not find" in result:
raise Exception("GetDistrictWealth: Param(s) are invalid.")
else:
return json.loads(result)
def GetDistrictUserWealth(district_name):
result = requests.get(f"https://api.spookvooper.com/Eco/GetDistrictUserWealth?id={district_name}").text
if "Could not find" in result:
raise Exception("GetDistrictUserWealth: Param(s) are invalid.")
else:
return json.loads(result)
def GetDistrictGroupWealth(district_name):
result = requests.get(f"https://api.spookvooper.com/Eco/GetDistrictGroupWealth?id={district_name}").text
if "Could not find" in result:
raise Exception("GetDistrictGroupWealth: Param(s) are invalid.")
else:
return json.loads(result)
def GetOwnerData(ticker):
result = requests.get(f"https://api.spookvooper.com/Eco/GetOwnerData?ticker={ticker}").text
if "Could not find" in result:
raise Exception("GetOwnerData: Param(s) are invalid.")
else:
return json.loads(result)