from blizzardapi2 import BlizzardApi import requests import webbrowser CLIENTID = "a79bae348867427690ca6df9903e4af0" CLIENTSECRET = "VfFc4JRxn4MpA5zRVut1gPIh6E5WrEC5" OAUTH_TOKEN = "USu4c0C0GINnehnDBOmip4ShEDIXUQ6BIO" REGION = "us" LOCALE = "en_US" api_client = BlizzardApi(CLIENTID, CLIENTSECRET) # def create_access_token(client_id, client_secret, region = 'us'): # data = { 'grant_type': 'client_credentials' } # response = requests.post('https://%s.battle.net/oauth/token' % region, data=data, auth=(client_id, client_secret)) # return response.json() # # response = create_access_token(CLIENTID, CLIENTSECRET) # print(response) # Unprotected API endpoint # categories_index = api_client.wow.game_data.get_achievement_categories_index(REGION, LOCALE) # print(categories_index) # Protected API endpoint summary = api_client.wow.profile.get_account_profile_summary(REGION, LOCALE, OAUTH_TOKEN) print(summary) # Wow Classic endpoint # connected_realms_index = api_client.wow.game_data.get_connected_realms_index("us", "en_US", is_classic=True) # print(connected_realms_index) # def get_character_profile(realm, character): # profile_info = api_client.wow.profile.get_character_profile_summary(REGION, LOCALE, realm, character) # return profile_info # # character_faction = get_character_profile("area-52", "izyrra")["faction"]["name"] # # print(character_faction)