forked from henrydatei/upland.me-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.py
163 lines (137 loc) · 7.04 KB
/
functions.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
import requests
userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"
def login(email, password):
jsondata = {"email": email, "password": password, "strategy": "local"}
headers = {'User-Agent': userAgent}
req = requests.post('https://api.upland.me/authentication', json=jsondata, headers=headers)
req.raise_for_status()
return req.text
def register(email, password, username):
# using the promo-code "cryptoticker" will give you 6000 UPX instead of 3000 UPX at the beginning
jsondata = {"email": email, "password": password, "username": username, "ab_token": "cryptotickerpromo1", "promo_code": "cryptoticker"}
headers = {'User-Agent': userAgent}
req = requests.post('https://api.upland.me/users', json=jsondata, headers=headers)
req.raise_for_status()
return req.text
def getDashboard(token):
headers={"authorization": "Bearer "+token}
req = requests.get('https://api.upland.me/dashboard', headers=headers)
req.raise_for_status()
return req.text
def getMoney(token, account_id):
headers={"authorization": "Bearer "+token}
req = requests.get('https://multiindex-api.upland.me/accounts/{}'.format(account_id), headers=headers)
req.raise_for_status()
return req.text
def renewVisa(token):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.post('https://api.upland.me/users/visa', headers=headers)
req.raise_for_status()
return req.text
def myProperties(token):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://api.upland.me/yield/mine', headers=headers)
req.raise_for_status()
return req.text
def myPropertiesDetailed(token):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://api.upland.me/properties/mine/detailed', headers=headers)
req.raise_for_status()
return req.text
def getNearbyProperties(token,north,south,east,west):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
parameters = {"north": north, "south": south, "east": east, "west": west}
req = requests.get('https://api.upland.me/map', headers=headers, params=parameters)
req.raise_for_status()
return req.text
def getNearbyPropertiesClusters(token,north,south,east,west):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
parameters = {"north": north, "south": south, "east": east, "west": west, "clusters": "true"}
req = requests.get('https://api.upland.me/map', headers=headers, params=parameters)
req.raise_for_status()
return req.text
def getNearbyPropertiesOnSale(token,north,south,east,west,sort_direction):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
parameters = {"north": north, "south": south, "east": east, "west": west, "offset": 0, "limit": 20, "sort": sort_direction}
req = requests.get('https://api.upland.me/properties/list-view', headers=headers, params=parameters)
req.raise_for_status()
return req.text
def getNearbySends(token,north,south,east,west):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
parameters = {"north": north, "south": south, "east": east, "west": west}
req = requests.get('https://treasures.upland.me/sends/discovery', headers=headers, params=parameters)
req.raise_for_status()
return req.text
def getListOfTreasureStates(token):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://treasures.upland.me/treasures', headers=headers)
req.raise_for_status()
return req.text
def getTreasureHistory(token):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://treasures.upland.me/treasures/history', headers=headers)
req.raise_for_status()
return req.text
def getTreasureDirectionForProperty(token, prop_id):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://treasures.upland.me/treasures/direction/{}'.format(prop_id), headers=headers)
req.raise_for_status()
return req.text
def getPropertyInformation(token, prop_id):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://api.upland.me/properties/{}'.format(prop_id), headers=headers)
req.raise_for_status()
return req.text
def findSuitableCollectionForProperty(token, prop_id):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://api.upland.me/properties/match/{}'.format(prop_id), headers=headers)
req.raise_for_status()
return req.text
def getPriceForTeleportToProperty(token, prop_id):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://api.upland.me/teleports/price/{}'.format(prop_id), headers=headers)
req.raise_for_status()
return req.text
def getNumberOfMessages(token):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://api.upland.me/messages/count', headers=headers)
req.raise_for_status()
return req.text
def getStorePrices(token):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
parameters = {"type": "upex"}
req = requests.get('https://api.upland.me/store', headers=headers, params=parameters)
req.raise_for_status()
return req.text
def isUnderMaintenance():
req = requests.get('https://api.upland.me/settings/maintenance')
req.raise_for_status()
return req.text
def claimRewardForCompletedCollection(token, collection_id):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
jsondata = {"collection_id": collection_id}
req = requests.post('https://api.upland.me/collections-completed/reward', json=jsondata, headers=headers)
req.raise_for_status()
return req.text
def getInformationAboutPlayer(token, username):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://api.upland.me/profile/{}'.format(username), headers=headers)
req.raise_for_status()
return req.text
def putPropertyInCollection(token, collection_id, prop_id):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
jsondata = {"collection_id": collection_id, "prop_id": prop_id}
req = requests.post('https://api.upland.me/coll-prop', json=jsondata, headers=headers)
req.raise_for_status()
return req.text
def collectSendTreasure(token, send_id):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
parameters = {"id": send_id}
req = requests.post('https://treasures.upland.me/sends/collect', headers=headers, params=parameters)
req.raise_for_status()
return req.text
def getPropertiesInRange(token):
headers={"authorization": "Bearer "+token, 'User-Agent': userAgent}
req = requests.get('https://api.upland.me/properties/tail/props', headers=headers)
req.raise_for_status()
return req.text