Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wotapi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wotapi

Extract data from the World of Tanks PC API

  • 0.4.6
  • PyPI
  • Socket score

Maintainers
1

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 PartNameDate CompletedVersion
AccountsPlayer Personal Data2020-04-240.0.1
AccountsPlayer Vehicles2020-04-240.0.1
AccountsPlayer Achievements2020-04-240.0.1
TankopediaVehicles2020-04-250.0.2
TankopediaAchievements2020-04-250.0.2
TankopediaTankopedia Information2020-04-250.0.2
TankopediaMaps2020-04-250.0.2
TankopediaBadges2020-04-280.4.22
TankopediaVehicle characteristics
TankopediaEnginesDeprecated
TankopediaTurretsDeprecated
TankopediaRadiosDeprecated
TankopediaSuspensionsDeprecated
TankopediaGunsDeprecated
TankopediaEquipment and Consumables
TankopediaPersonal Missions
TankopediaPersonal Reserves
TankopediaVehicle Configurations
TankopediaModules
TankopediaCrew Qualifications
TankopediaCrew Skills
VehiclesVehicle statistics2020-04-270.3.2
VehiclesVehicle achievements2020-04-270.3.2
ClansClans
ClansClan Details
ClansClan Member Details
ClansClan Glossary
ClansMessage Board
ClansPlayer Clan History
Clan ratingsTypes of Ratings
Clan ratingsDates with available r.
Clan ratingsClan Ratings
Clan ratingsAdj Positions In Clan R.
Clan ratingsTop 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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc