Unofficial Python library that facilitates working with API Wargaming.net and
API Lesta Games functionality via Python.
By downloading this library you fully agree with all official documents Lesta Games and Wargaming.net about Lesta Games and Wargaming.net products. The author of the library (Alexander Podstrechny) is not responsible for your actions performed with the help of this program code.
Run the command below at the command line
pip install WgLestaAPI
- The presence of synchronous and asynchronous methods of working with the API;
- The ability to use any available methods of the official API through this single library;
- The ability to run a single
*.py
program in several different regions; - Built-in constants to designate all games and regions for
API Wargaming.net and
API Lesta Games;
- One App class with all the necessary library methods.
- Choice your API provider:
API Wargaming.net or
API Lesta Games;
- Log in to the official API provider service;
- Create a new application by clicking on the button Add application or use the existing;
- Copy ID field from webpage;
from WgLestaAPI.Application import App
from WgLestaAPI.Constants import REGION, GAMENAMES
import json
wgApp = App("YOUR_APPLICATION_ID", REGION.EU)
resp = wgApp.execute("account.info", GAMENAMES.SHORTNAMES.WOT, account_id=563982544)
print(json.dumps(resp, indent=2))
In the terminal you will see:
{
"status": "ok",
"meta": {
"count": 1
},
"data": {
"563982544": {
"client_language": "",
"last_battle_time": 1569011404,
"account_id": 563982544,
"created_at": 1564320823,
"updated_at": 1715246332,
"private": null,
"global_rating": 1828,
"clan_id": null,
"statistics": {
// ...
},
"nickname": "tankalxat34",
"logout_at": 1597741881
}
}
}
from WgLestaAPI.Application import App
from WgLestaAPI.Constants import REGION, GAMENAMES
import json
import asyncio
wgApp = App("YOUR_APPLICATION_ID", REGION.EU)
async def getMyAccount(myId: int):
return await wgApp.asyncExecute("account.info", GAMENAMES.SHORTNAMES.WOT, account_id=myId)
resp = asyncio.run(getMyAccount(myId=563982544))
print(json.dumps(resp, indent=2))
In the terminal you will see:
{
"status": "ok",
"meta": {
"count": 1
},
"data": {
"563982544": {
"client_language": "",
"last_battle_time": 1569011404,
"account_id": 563982544,
"created_at": 1564320823,
"updated_at": 1715246332,
"private": null,
"global_rating": 1828,
"clan_id": null,
"statistics": {
// ...
},
"nickname": "tankalxat34",
"logout_at": 1597741881
}
}
}
You can use the library to generate API links for user authorization in your application. This will allow your application to get an access_token, which can be passed as a parameter inside a request to any available API method
from WgLestaAPI.Application import App
from WgLestaAPI.Constants import REGION, GAMENAMES
wgApp = App("YOUR_APPLICATION_ID", REGION.EU)
print(wgApp.login(redirect_uri="https://example.com/")) # url to your hosted web-application
print(wgApp.logout())
print(wgApp.prolongate())
In the terminal you will see:
https://api.worldoftanks.eu/wot/auth/login/?application_id=YOUR_APPLICATION_ID&redirect_uri=https://example.com/
https://api.worldoftanks.eu/wot/auth/logout/?application_id=YOUR_APPLICATION_ID
https://api.worldoftanks.eu/wot/auth/prolongate/?application_id=YOUR_APPLICATION_ID
The library implements the basic functions of API Lesta Games and API Wargaming.net. All requests are made through your application, which you previously created on Lesta Games or on
Wargaming.net. Some features are listed below:
- Getting information about the player, his equipment and medals.
- Obtaining information about the clan.
- Getting information about vehicles.
- And other methods.
- 2024 © Alexander Podstrechnyy.
- 2024 © Wargaming.net. All rights reserved.
- 2024 © Lesta Games. All rights reserved.
This program code is not a product of Lesta Games and was developed according to Lesta Games DPP rules.
This program code is not a product of Wargaming.net and is developed according to WG DPP rules.