pywot

A python interface to Wargaming.net's World of Tanks API


Keywords
world, of, tanks, wargaming, wot
License
Other
Install
pip install pywot==0.1

Documentation

PyWOT: Python World of Tanks API Wrapper

https://travis-ci.org/mattselph/pywot.svg?branch=master

A library providing a python interface to Wargaming.net's World of Tanks API. In order to use this API, you must register as a developer and add an application for free at Wargaming.net. You will then be given an application ID that you will use when making API calls.

As of this release the API only works with the North American servers.

All results are returned as JSON documents.

Installation

PyWOT works with Python 2.6 and Python 2.7. Install using pip:

$ pip install pywot

Usage

Once you obtain your Application ID, you can use it to instantiate new instances of the various classes (Tankopedia, Player, Rating, Vehicles). The following will get a list of all the tanks in the game:

>>> from pywot.tankopedia import Tankopedia
>>> t = Tankopedia('your-app-id')
>>> print(t.list_of_vehicles())

You can get the details of a particular tank with the vehicle_details method. Here is how you would get the details of the KV-1S:

>>> print t.vehicle_details(tank_id=18689)

Or, just get a few fields:

>>> print t.vehicle_details(
        tank_id=18689,
        fields=['tank_id', 'nation', 'speed_limit', 'engines.module_id'])

The field names can be obtained from the API Reference. They can be passed in as a comma-delimited string or a python list of string values, as shown above. You can also pass in multipe tank_id's the same way:

>>> print(t.vehicle_details(tank_id=18689,      fields=['tank_id','nation','speed_limit','engines.module_id']))

PyWOT also supports specifying different languages for the response:

>>> print(t.vehicle_details(
        language='ko',
        tank_id=['18689','33'],
        fields=['tank_id', 'nation', 'speed_limit', 'engines.module_id']))

Querying for player statistics can be done by supplying either an account_id or a nickname.

To get all the achievements of a player with the nickname "lulz_man" do the following:

>>> from pywot.player import Player
>>> p = Player('your-app-id')
>>> print(p.player_achievements(nickname='lulz_man'))

The wrapper will handle figuring out what the account_id is.

If you aren't sure what the player's nickname is, you can use the search_players method to find it.

If you already have an account_id, you can supply that as well. Here's how to get all the vehicles from a player if his or her account_id is known:

>>> from pywot.player import Player
>>> p = Player('your-app-id')
>>> print(p.player_vehicles(1008273454))

License

All of the code contained here is licensed by the Apache 2.0 License.