用于python的guild wars 2api客户端。
gw2的Python项目详细描述
用于python的guild wars 2 api客户端。
安装
pip install gw2
建议使用virtual environment。
用法
importgw2client=gw2.Client()client.get('achievements/daily')client.get('achievements',ids=[1,2])# pass query parameters as keyword argumentsclient.auth('YOUR-API-KEY')# set api key for authenticated endpointsclient.get('account')
要处理错误响应:
try:client.get('...')exceptgw2.HTTPErrorase:print(e.response.status_code,e.response.json())