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
What doesn't work?
Getting hero image urls from the hero names generated by api.get_heroes(). Neither
localized_name
orname
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?