-
Notifications
You must be signed in to change notification settings - Fork 0
/
rivenEndo.py
38 lines (26 loc) · 1.08 KB
/
rivenEndo.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
import requests
from riven import RivenAuction
itemsUrl = "https://api.warframe.market/v1/riven/items"
auctionUrl = "https://api.warframe.market/v1/auctions/search?type=riven&weapon_url_name={}"
def run():
r = requests.get(itemsUrl)
data = r.json()
del r
paylod = data["payload"]["items"]
entries = [entry["url_name"] for entry in paylod]
rivenCount = len(entries)
endoTarget = []
for i, entry in enumerate(entries):
segmentRequest = requests.get(auctionUrl.format(entry))
segmnetData = segmentRequest.json()
segmentPaylod = segmnetData["payload"]["auctions"]
for entry in segmentPaylod:
if entry["buyout_price"] is None:
continue
endoTarget.append(RivenAuction(entry["id"], entry["buyout_price"], entry["item"]["mastery_level"], entry["item"]["mod_rank"], entry["item"]["re_rolls"]))
print(f"{i} of {rivenCount}: total of {len(endoTarget)} items found")
endoTarget.sort(reverse=True)
return endoTarget
def render(endoTarget, n):
for e in endoTarget[:n]:
print(e)