Skip to main content

Unofficial Python library that implements the Wargaming.net API and Lesta Games API functionality

Project description

WgLestaAPI

Unofficial Python library that facilitates working with API Wargaming.net and API Lesta Games functionality via Python.

Downloads Downloads Downloads Supported Versions Version GitHub Repo stars

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.

Installing the library

Run the command below at the command line

pip install WgLestaAPI

The main advantages

  • 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.

Quickstart

1. Get an application_id

  1. Choice your API provider: API Wargaming.net or API Lesta Games;
  2. Log in to the official API provider service;
  3. Create a new application by clicking on the button Add application or use the existing;
  4. Copy ID field from webpage;

2. Write a synchron variant of the "Hello world" example

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
    }
  }
}

3. Write an async variant of the "Hello world" example

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
    }
  }
}

4. Get URL to login, logout and prolongate access_token actions into your application

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

Library functionality

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.

Copyright Notice

 

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wglestaapi-1.0.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

wglestaapi-1.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file wglestaapi-1.0.0.tar.gz.

File metadata

  • Download URL: wglestaapi-1.0.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11

File hashes

Hashes for wglestaapi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 649e06c951035c2f1ff007bce58d1071fd20aa81373d6c64152329679a460131
MD5 31c9a9b91043bbcdbc2e6538ffa692cc
BLAKE2b-256 0b6adb1b03f893c83daf7f8dafe7731a58813bfebdba29e9be8c13005459b7f1

See more details on using hashes here.

File details

Details for the file wglestaapi-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: wglestaapi-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11

File hashes

Hashes for wglestaapi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbe0695517cd60e68e5855de7e95aeb54422cbd2082fe6083b61eafbaa1b1996
MD5 374f3d5164a64ec53e6e54787f9a303e
BLAKE2b-256 151d7c396d1fbc9004a32f685963c5884355be95900d9623ce45c9a32336cb29

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page