blizzard-wow-game-data-apis/blizzard.py

14 lines
516 B
Python

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(':'))