Skip to main content

Downloads MIT license codecov

World of Tanks - API (PC)

1. Description

This package will extract data from the Wargaming World of Tanks API.
Currently, this works only for the PC version with the rest of the platforms to be implemented in future iterations.

The package will require the following from the official World of Tanks Developer API page.

  • application id
  • account id
  • access token

All data extracted will be written to a local sqlite database ready to be accessed. The database is automatically created at the location where the script is executed.
The name of the database is world_of_tanks.db of type sqlite.

2. Install

pip install WotAPI

3. Usage

from wotapi import WotAPI, REALM

# Obtain the account id
# Since this is a constant it can be executed only once to get the account_id
wot = WotAPI(application_id='############', 
             realm=REALM.eu)
account_id = wot.get_account_id(nickname='username')


wot = WotAPI(application_id='############',
             account_id=account_id, 
             token='#########',
             realm='eu')

# Extract Account Data
wot.player_personal()
wot.player_vehicles()
wot.player_achievements()

# Extract Tankopedia Data
wot.tankopedia_vehicles(load_once=True)
wot.tankopedia_achievements(load_once=True)
wot.tankopedia_information(load_once=True)
wot.tankopedia_maps(load_once=True)
wot.tankopedia_badges(load_once=True)

# Extract Player Vehicles Data
wot.vehicle_achievements()
wot.vehicle_statistics()

# Renew access token
new_token_data = wot.renew_token()
print(new_token_data)

All data from the Tankopedia part of the API needs to be loaded only once in the database, otherwise this will be duplicated. For ease, the argument load_once is by default set to True.

The data can be accessed from the wot objects for further development. The response is a list of dictionaries.

achievements = wot.player_achivements(load_once=True)
print(achievements)

[{
'name': 'medalBobAmway921', 
'outdated': True, 
'section': 'action', 
'section_order': 6, 
'image_big': 'http://api.worldoftanks.eu/static/2.66.0/wot/encyclopedia/achievement/big/medalBobAmway921.png', 
'hero_info': None, 
'name_i18n': None, 
'order': 1443, 
'type': 'single', 
'image': 'http://api.worldoftanks.eu/static/2.66.0/wot/encyclopedia/achievement/medalBobAmway921.png', 
'condition': 'None', 
'description': None
} ... 
]

To not load data in the database add the load_to_db=False argument to the WotAPI class parameters. To give a specific location for the database to be created and populated set up the following arguments in the main class.

from worldoftanks import WotAPI

wot = WotAPI(application_id='####',
             account_id='##########',
             token='#########',
             realm='eu',
             load_to_db=True,
             db_path=<path_where_the_database_will_be_saved>,
             logging_enabled=True/False,
             log_level="WARNING"                     
    )

4. Left To Do

API Part Name Date Completed Version
Accounts Player Personal Data 2020-04-24 0.0.1
Accounts Player Vehicles 2020-04-24 0.0.1
Accounts Player Achievements 2020-04-24 0.0.1
Tankopedia Vehicles 2020-04-25 0.0.2
Tankopedia Achievements 2020-04-25 0.0.2
Tankopedia Tankopedia Information 2020-04-25 0.0.2
Tankopedia Maps 2020-04-25 0.0.2
Tankopedia Badges 2020-04-28 0.4.22
Tankopedia Vehicle characteristics
Tankopedia Engines Deprecated
Tankopedia Turrets Deprecated
Tankopedia Radios Deprecated
Tankopedia Suspensions Deprecated
Tankopedia Guns Deprecated
Tankopedia Equipment and Consumables
Tankopedia Personal Missions
Tankopedia Personal Reserves
Tankopedia Vehicle Configurations
Tankopedia Modules
Tankopedia Crew Qualifications
Tankopedia Crew Skills
Vehicles Vehicle statistics 2020-04-27 0.3.2
Vehicles Vehicle achievements 2020-04-27 0.3.2
Clans Clans
Clans Clan Details
Clans Clan Member Details
Clans Clan Glossary
Clans Message Board
Clans Player Clan History
Clan ratings Types of Ratings
Clan ratings Dates with available r.
Clan ratings Clan Ratings
Clan ratings Adj Positions In Clan R.
Clan ratings Top Clans
Strongholds
Global Map

5. Development

To further develop this package please follow the instructions below

# Install the virtual environments and packages
python3 -m virtualenv .venv
source .venv/bin/activate
pip3 install -r requirements.txt

# Run test suite
# Tests contain unittests, coverage and linting
tox

Release files for wotapi 0.4.6

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

Source distribution (sdist)

Source distribution for wotapi 0.4.6
File Size Uploaded
wotapi-0.4.6.tar.gz 33.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wotapi 0.4.6
File Interpreter ABI Platform
wotapi-0.4.6-py3-none-any.whl Python 3 none any Details

Total release size: 90.3 kB

Release files / wotapi-0.4.6.tar.gz

Download URL wotapi-0.4.6.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ea107dae265b9ff27020ac35e85514cb8a66bf40e308765ae5b01c8b135f3ce4
BLAKE2b-256 checksum
How to use checksums
77c4391229c236d3e60b61268751db56017709a676302cde63fa43aafdb89319
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / wotapi-0.4.6-py3-none-any.whl

Download URL wotapi-0.4.6-py3-none-any.whl
Size 56.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3455a78d24111ed1d23ccc23ab9f94fddaa2d4d30a7507fcefb856de32c84dfa
BLAKE2b-256 checksum
How to use checksums
7dec7aa8bf996910fca4260961235b9969116d25c8e40e54b22b6a6256525f71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release history Release notifications | RSS feed

This release

0.4.6 This release

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.3.3

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