Files
  • main.py
main.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
import urllib.request, json
price = {}
with urllib.request.urlopen("https://steamcommunity.com/market/search/render/?search_descriptions=0&category_583950_Rarity%5B%5D=tag_Rarity_Common&sort_dir=desc&appid=583950&norender=1&count=500") as url:
    data = json.loads(url.read().decode())
for entry in data['results']:
    price[entry['name']] = entry['sell_price']/100
with urllib.request.urlopen("https://steamcommunity.com/market/search/render/?search_descriptions=0&category_583950_Rarity%5B%5D=tag_Rarity_Uncommon&sort_dir=desc&appid=583950&norender=1&count=500") as url:
    data = json.loads(url.read().decode())
for entry in data['results']:
    price[entry['name']] = entry['sell_price']/100
rare = {}
with urllib.request.urlopen("https://steamcommunity.com/market/search/render/?search_descriptions=0&category_583950_Rarity%5B%5D=tag_Rarity_Rare&sort_dir=desc&appid=583950&norender=1&count=500") as url:
    data = json.loads(url.read().decode())
for entry in data['results']:
    price[entry['name']] = entry['sell_price']/100
heroes = ["Zeus", "Enchantress", "Magnus", "Bounty Hunter", "Lion", "Bloodseeker", "Ogre Magi", "Necrophos", "Crystal Maiden", "Dark Seer", "Beastmaster", "Mazzie", "Bristleback", "Sven", "Lycan" , "Treant Protector", "Skywrath Mage", "Venomancer", "Phantom Assassin", "Ursa", "Viper", "Outworld Devourer", "Luna", "Timbersaw", "Tidehunter", "Rix", "Winter Wyvern", "Sniper", "Prellex", "Sorla Khan", "Legion Commander", "Storm Spirit", "Centaur Warrunner", "Chen", "Earthshaker", "Drow Ranger", "Meepo", "Axe", "Tinker", "Lich", "Omniknight", "Pugna"]
starter = ["Sven", "Lycan", "Ursa", "Necrophos", "Skywrath Mage", "Ogre Magi"]
total = 0
for cost in price:
    if cost in heroes:
        total += price[cost]
    else:
        total += 3 * price[cost]
    if cost in starter:
        total -= price[cost]
print(total)
Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux