Last active
August 29, 2015 14:25
-
-
Save marlhammer/4e6789078ace54692562 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httplib2 | |
import json | |
# Parameters: | |
# | |
character_name = "Marlhammer" | |
server = "Khadgar" | |
# Script: | |
# | |
base_url="http://us.battle.net/api/wow/character/" | |
base_url+=server | |
base_url+="/" | |
base_url+=character_name | |
base_url+="?fields=achievements,appearance,mounts,pets,professions,progression,pvp,quests,reputation,stats,talents,titles" | |
resp, content = httplib2.Http().request(base_url) | |
output = open(character_name + '.json', 'w') | |
character_json = json.loads(content) | |
json.dump(character_json, output, sort_keys=True, indent=4, separators=(',', ': ')) | |
output.write("\n") | |
for achievement in character_json["achievements"]["achievementsCompleted"]: | |
resp, content = httplib2.Http().request("http://us.battle.net/api/wow/achievement/"+str(achievement)) | |
achievement_json = json.loads(content) | |
json.dump(achievement_json, output, sort_keys=True, indent=4, separators=(',', ': ')) | |
output.write("\n") | |
print str(achievement) | |
print "\nCompleted!\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment