Wargaming API Library with asyncio support Compatible with Python 3.5+
Library was created for my personal purposes, so it may contain some bugs and strange code :)
¯\_(ツ)_/¯ Only manual
>>> from wglib import api
>>> wot = api.WoT("application_id", "region") # World of Tanks API
>>> wotb = api.WoTB("application_id", "region") # World of Tanks Blitz API
>>> wotx = api.WoTX("application_id", "platform") # World of Tanks Console API
>>> wows = api.WoWS("application_id", "region") # World of Warships API
>>> wowp = api.WoWS("application_id", "region") # World of Warplanes API
>>> wgn = api.WGN("application_id", "region") # Wargaming Network API
Available regions can be found in the Wargaming PAPI documentation.
Available platforms at the moment are xbox
and ps4
.
You can also specify a default language for API:
>>> wot = api.WoT("demo", "ru", language="en") # World of Tanks API
And use async API:
>>> from wglib.aio import api
>>> aiowgn = api.WGN("application_id", "region") # Wargaming Network API
Available request methods can be found in the Wargaming PAPI reference.
"""
Game servers info
https://developers.wargaming.net/reference/all/wgn/servers/info/
"""
>>> res = wgn.servers.info(game="wot")
<wglib.api.base.Response object>
>>> res = await aiowgn.servers.info(game="wot") # async/await syntax
<wglib.api.base.Response object>
Response object contains raw (json) data in the res.raw
and parsed data in the res.data
.
>>> res.data
{'status': 'ok', 'data': {'wot': [{'server': 'RU1', 'players_online': 47845} ...
>>> res.data["status"]
'ok'
>>> res["status"] # dict-like
'ok'
The MIT License (MIT)
Copyright (c) 2016 Nariman Safiulin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.