Versioning changes for Blizzard WoW Game Data APIs https://develop.battle.net/documentation/world-of-warcraft/game-data-apis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

16 lines
618 B

import os
from typing import Tuple
def get_api_host(region: str) -> str:
return f"https://{region}.api.blizzard.com" if region != 'cn' else 'https://gateway.battlenet.com.cn'
def get_bnet_host(region: str) -> str:
region = region if region not in ['tw', 'kr'] else 'apac'
return f"https://{region}.battle.net" if region != 'cn' else 'https://www.battlenet.com.cn'
def get_credentials(path: str) -> Tuple[str, str]:
return tuple(open(os.path.join(path, '.credentials')).read().strip().split(':'))
def get_by_key(values: list, key: str, value):
return next(x for x in values if x[key] == value)