Skip to main content

Introduction

WOTConsole is a Python module for interacting with the Wargaming’s developer API, specifically for the World of Tanks - Console game. It is a tool designed for convenience and ease-of-use.

Documentation Status

Why create another API wrapper?

While Wargaming offers their own API wrapper, and another was built by a third-party, they respectively do not have the WOTX (World of Tanks Console) endpoints or do not have sufficient documentation to understand how to fully utilize their libraries. As such, I took it upon myself to create one that was thorough and easy to use.

Why not stick with requests <https://pypi.org/project/requests/>?

While the requests library may suffice for general use, it can be a bit of a pain having to remember what parameters should be sent and what the URL endpoint is. It’s also inconvenient when trying to code offline. This module has all of this documented and will track the URLs for you.

Eww, Python!

Grow up ;)

What can it do?

WOTConsole is designed for convenience to the developer. Let’s say that you’re needing to search for a tank.

This module intends to address some of these issues and even those that most developers may not care for. We can rewrite the code as follows:

>>> from __future__ import print_function
>>> from copy import copy
>>> from wotconsole import tank_info

>>> apikey = 'demo'

# You can specify the platform and language you want.
>>> psinfo = vehicle_info(apikey, tank_id='1', fields=['short_name',
... 'tier', 'type', 'nation'], api_realm='ps4', language='ru')

# Some parameters accept lists of multiple types
>>> xinfo = tank_info(apikey, tank_id=[1, '257'])
>>> print type(psinfo)
<class 'wotconsole.WOTXResponse'>

# The data returned was a dictionary; the WOTXResponse will behave as one
>>> for tank_id, data in psinfo.iteritems():
...    print(tank_id, data)
1 {u'tier': 5, u'type': u'mediumTank', u'short_name': u'T-34',
   u'nation': u'ussr'}

# You can directly access the data using indices
>>> print(xinfo['1']['short_name'])
T-34
>>> print(xinfo['257']['short_name'])
SU-85

# Should you need to `copy` the data, access it as an attribute
>>> copied = copy(xinfo.data)
>>> print(type(copied))
<type 'dict'>

>>> try:
...     vehicle_info(apikey, tank_id='A')

>>> except WOTXResponseError as wat:
# If an error occurs from bad parameters being sent to the API, the
# `Exception` will instead use the error message sent back in the JSON.
...     print(wat)
INVALID_TANK_ID

# The JSON becomes part of the `Exception`, allowing for debugging even
# outside of a method's scope.
...     print(wat.error['code'])
407
...     print(wat.error['field'])
tank_id

# Both `WOTXResponse` and `WOTXResponseError` save the original
# `requests` instance, just in case the developer wishes to review the
# parameters, URL, etc.
...     print(type(wat.raw))
<class 'requests.models.Response'>

What improvements will we see?

An up-to-date list of planned features will always be in the TODO.rst file.

Release files for wotconsole 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wotconsole 0.4.2
File Size Uploaded
wotconsole-0.4.2.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wotconsole 0.4.2
File Interpreter ABI Platform
wotconsole-0.4.2-py2-none-any.whl Python 2 none any Details

Total release size: 28.3 kB

Release files / wotconsole-0.4.2.tar.gz

Download URL wotconsole-0.4.2.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
705e0b4940d6eab7fa78036a1b77947c2bdb0fbae26ffd03b30518c39f975540
BLAKE2b-256 checksum
How to use checksums
d45c2fb101c31fc7e30c553dda88e11c333c266b5bbbb566db8027dbb9e4bf3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

Release files / wotconsole-0.4.2-py2-none-any.whl

Download URL wotconsole-0.4.2-py2-none-any.whl
Size 16.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
74d931d777f39281479859b3831d294cd4ad00fbf29f35b7378746301afdc30f
BLAKE2b-256 checksum
How to use checksums
255bc91e58f57c5b2893298a6ceb82ecd1f9f961f8465f13ad88f0eb257cad2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page