andrewsnowden / dota2py

Python tools for Dota 2
MIT License
115 stars 36 forks source link

Getting hero image urls from hero names isn't working #12

Closed GuitaringEgg closed 10 years ago

GuitaringEgg commented 10 years ago

What doesn't work?

Getting hero image urls from the hero names generated by api.get_heroes(). Neither localized_name or name give valid urls. I don't know if this is intended or not, but I was trying to quickly download all the hero images and this struck me as odd. I can just remove 'npc_dotahero' from the name to get valid urls, but I was just wanting to make you aware of this oddity.

How to recreate?

import urllib2
from dota2py import api
for hero in api.get_heroes()["result"]["heroes"]:
    url = api.get_hero_image_url(hero["name"])
    data = urllib2.urlopen(url)
# will throw a urllib2.HTTPError
andrewsnowden commented 10 years ago

Yeah makes sense that this should work - thanks for the feedback