WgLestaAPI


NameWgLestaAPI JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/tankalxat34/WgLestaAPI
SummaryUnofficial Python library that implements the Wargaming.net API and Lesta Games API functionality
upload_time2024-06-26 09:15:34
maintainerNone
docs_urlNone
authorAlexander Podstrechnyy
requires_python<4.0,>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # WgLestaAPI

Unofficial Python library that facilitates working with **<a href="https://developers.wargaming.net"><img src="docs/icons/wg.ico" width=15px> API Wargaming.net</a>** and **<a href="https://developers.lesta.ru"><img src="docs/icons/lesta.ico" width=15px> API Lesta Games</a>** functionality via **Python**.

[![Downloads](https://static.pepy.tech/personalized-badge/wglestaapi?period=total&units=international_system&left_color=grey&right_color=blue&left_text=downloads)](https://pepy.tech/project/wglestaapi)
[![Downloads](https://static.pepy.tech/personalized-badge/wglestaapi?period=month&units=international_system&left_color=grey&right_color=blue&left_text=downloads/month)](https://pepy.tech/project/wglestaapi)
[![Downloads](https://static.pepy.tech/personalized-badge/wglestaapi?period=week&units=international_system&left_color=grey&right_color=blue&left_text=downloads/week)](https://pepy.tech/project/wglestaapi)
[![Supported Versions](https://img.shields.io/pypi/pyversions/wglestaapi)](https://pypi.org/project/wglestaapi)
[![Version](https://img.shields.io/pypi/v/wglestaapi?color=success)](https://pypi.org/project/wglestaapi)
[![](https://img.shields.io/pypi/format/wglestaapi)](https://pypi.org/project/wglestaapi)
[![](https://img.shields.io/pypi/wheel/wglestaapi)](https://pypi.org/project/wglestaapi)
[![GitHub Repo stars](https://img.shields.io/github/stars/tankalxat34/wglestaapi?style=social)](https://github.com/tankalxat34/wglestaapi)

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](https://github.com/tankalxat34)) 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 **<a href="https://developers.wargaming.net"><img src="docs/icons/wg.ico" width=15px> API Wargaming.net</a>** and **<a href="https://developers.lesta.ru"><img src="docs/icons/lesta.ico" width=15px> API Lesta Games</a>**;
* One App class with all the necessary library methods.

## Quickstart

### 1. Get an `application_id`
1. Choice your API provider: **<a href="https://developers.wargaming.net"><img src="docs/icons/wg.ico" width=15px> API Wargaming.net</a>** or **<a href="https://developers.lesta.ru"><img src="docs/icons/lesta.ico" width=15px> API Lesta Games</a>**;
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;


<img src="docs/picture1.png" width=900px>

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

```python
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:

```json
{
  "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

```python
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:

```json
{
  "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

```python
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 [<img src="docs/icons/lesta.ico" width=14px> Lesta Games](https://developers.lesta.ru/applications/) or on [<img src="docs/icons/wg.ico" width=14px> Wargaming.net](https://developers.wargaming.net/applications/). 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

<a href="https://developers.lesta.ru/"><img src="docs/icons/lesta_logo.png" width="178px" style="margin: 20px;"></a> <a href="https://developers.wargaming.net/"><img src="docs/icons/wg_logo.png" width="150px" style="margin: 20px;"></a>

- 2024 © Alexander Podstrechnyy. 
    - [tankalxat34@gmail.com](mailto:tankalxat34@gmail.com?subject=lestagamesapi)
    - [VKontakte](https://vk.com/tankalxat34)
    - [Telegram](https://tankalxat34.t.me)
    - [GithHub](https://github.com/tankalxat34/wglestaapi)
- 2024 © Wargaming.net. All rights reserved.
    - [User Support Center](http://support.wargaming.net/)
    - [Official website](https://wargaming.net/)
    - [License Agreement](https://eu.wargaming.net/user_agreement/)
    - [Privacy Policy](https://eu.wargaming.net/privacy_policy/)
- 2024 © Lesta Games. All rights reserved. 
    - [User Support Center](https://lesta.ru/support/)
    - [Official website](https://lesta.ru/)
    - [License Agreement](https://developers.lesta.ru/documentation/rules/agreement/)
    - [Privacy Policy](https://legal.lesta.ru/privacy-policy/)

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tankalxat34/WgLestaAPI",
    "name": "WgLestaAPI",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Alexander Podstrechnyy",
    "author_email": "tankalxat34@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/eb/9b/75c595cd82e857b4a8e067e48279adebb2f4c8f53d0887fc8fe4c4dcacc2/wglestaapi-1.0.1.tar.gz",
    "platform": null,
    "description": "# WgLestaAPI\n\nUnofficial Python library that facilitates working with **<a href=\"https://developers.wargaming.net\"><img src=\"docs/icons/wg.ico\" width=15px> API Wargaming.net</a>** and **<a href=\"https://developers.lesta.ru\"><img src=\"docs/icons/lesta.ico\" width=15px> API Lesta Games</a>** functionality via **Python**.\n\n[![Downloads](https://static.pepy.tech/personalized-badge/wglestaapi?period=total&units=international_system&left_color=grey&right_color=blue&left_text=downloads)](https://pepy.tech/project/wglestaapi)\n[![Downloads](https://static.pepy.tech/personalized-badge/wglestaapi?period=month&units=international_system&left_color=grey&right_color=blue&left_text=downloads/month)](https://pepy.tech/project/wglestaapi)\n[![Downloads](https://static.pepy.tech/personalized-badge/wglestaapi?period=week&units=international_system&left_color=grey&right_color=blue&left_text=downloads/week)](https://pepy.tech/project/wglestaapi)\n[![Supported Versions](https://img.shields.io/pypi/pyversions/wglestaapi)](https://pypi.org/project/wglestaapi)\n[![Version](https://img.shields.io/pypi/v/wglestaapi?color=success)](https://pypi.org/project/wglestaapi)\n[![](https://img.shields.io/pypi/format/wglestaapi)](https://pypi.org/project/wglestaapi)\n[![](https://img.shields.io/pypi/wheel/wglestaapi)](https://pypi.org/project/wglestaapi)\n[![GitHub Repo stars](https://img.shields.io/github/stars/tankalxat34/wglestaapi?style=social)](https://github.com/tankalxat34/wglestaapi)\n\nBy 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](https://github.com/tankalxat34)) is not responsible for your actions performed with the help of this program code.*\n\n## Installing the library\n\nRun the command below at the command line\n\n```\npip install WgLestaAPI\n```\n\n\n## The main advantages\n\n* The presence of synchronous and asynchronous methods of working with the API;\n* The ability to use any available methods of the official API through this single library;\n* The ability to run a single `*.py` program in several different regions;\n* Built-in constants to designate all games and regions for **<a href=\"https://developers.wargaming.net\"><img src=\"docs/icons/wg.ico\" width=15px> API Wargaming.net</a>** and **<a href=\"https://developers.lesta.ru\"><img src=\"docs/icons/lesta.ico\" width=15px> API Lesta Games</a>**;\n* One App class with all the necessary library methods.\n\n## Quickstart\n\n### 1. Get an `application_id`\n1. Choice your API provider: **<a href=\"https://developers.wargaming.net\"><img src=\"docs/icons/wg.ico\" width=15px> API Wargaming.net</a>** or **<a href=\"https://developers.lesta.ru\"><img src=\"docs/icons/lesta.ico\" width=15px> API Lesta Games</a>**;\n2. Log in to the official API provider service;\n3. Create a new application by clicking on the button **Add application** or use the existing;\n4. Copy ID field from webpage;\n\n\n<img src=\"docs/picture1.png\" width=900px>\n\n### 2. Write a synchron variant of the \"Hello world\" example\n\n```python\nfrom WgLestaAPI.Application import App\nfrom WgLestaAPI.Constants import REGION, GAMENAMES\nimport json\n\nwgApp = App(\"YOUR_APPLICATION_ID\", REGION.EU)\n\nresp = wgApp.execute(\"account.info\", GAMENAMES.SHORTNAMES.WOT, account_id=563982544)\nprint(json.dumps(resp, indent=2))\n\n```\n\nIn the terminal you will see:\n\n```json\n{\n  \"status\": \"ok\",\n  \"meta\": {\n    \"count\": 1\n  },\n  \"data\": {\n    \"563982544\": {\n      \"client_language\": \"\",\n      \"last_battle_time\": 1569011404,\n      \"account_id\": 563982544,\n      \"created_at\": 1564320823,\n      \"updated_at\": 1715246332,\n      \"private\": null,\n      \"global_rating\": 1828,\n      \"clan_id\": null,\n      \"statistics\": {\n        // ...\n      },\n      \"nickname\": \"tankalxat34\",\n      \"logout_at\": 1597741881\n    }\n  }\n}\n```\n\n\n### 3. Write an async variant of the \"Hello world\" example\n\n```python\nfrom WgLestaAPI.Application import App\nfrom WgLestaAPI.Constants import REGION, GAMENAMES\nimport json\nimport asyncio\n\nwgApp = App(\"YOUR_APPLICATION_ID\", REGION.EU)\n\nasync def getMyAccount(myId: int):\n    return await wgApp.asyncExecute(\"account.info\", GAMENAMES.SHORTNAMES.WOT, account_id=myId)\n\nresp = asyncio.run(getMyAccount(myId=563982544))\nprint(json.dumps(resp, indent=2))\n```\n\nIn the terminal you will see:\n\n```json\n{\n  \"status\": \"ok\",\n  \"meta\": {\n    \"count\": 1\n  },\n  \"data\": {\n    \"563982544\": {\n      \"client_language\": \"\",\n      \"last_battle_time\": 1569011404,\n      \"account_id\": 563982544,\n      \"created_at\": 1564320823,\n      \"updated_at\": 1715246332,\n      \"private\": null,\n      \"global_rating\": 1828,\n      \"clan_id\": null,\n      \"statistics\": {\n        // ...\n      },\n      \"nickname\": \"tankalxat34\",\n      \"logout_at\": 1597741881\n    }\n  }\n}\n```\n\n### 4. Get URL to login, logout and prolongate `access_token` actions into your application\n\nYou 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\n\n```python\nfrom WgLestaAPI.Application import App\nfrom WgLestaAPI.Constants import REGION, GAMENAMES\n\nwgApp = App(\"YOUR_APPLICATION_ID\", REGION.EU)\n\nprint(wgApp.login(redirect_uri=\"https://example.com/\")) # url to your hosted web-application\nprint(wgApp.logout())\nprint(wgApp.prolongate())\n```\n\nIn the terminal you will see:\n\n```\nhttps://api.worldoftanks.eu/wot/auth/login/?application_id=YOUR_APPLICATION_ID&redirect_uri=https://example.com/\nhttps://api.worldoftanks.eu/wot/auth/logout/?application_id=YOUR_APPLICATION_ID\nhttps://api.worldoftanks.eu/wot/auth/prolongate/?application_id=YOUR_APPLICATION_ID\n```\n\n\n## Library functionality\n\nThe 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 [<img src=\"docs/icons/lesta.ico\" width=14px> Lesta Games](https://developers.lesta.ru/applications/) or on [<img src=\"docs/icons/wg.ico\" width=14px> Wargaming.net](https://developers.wargaming.net/applications/). Some features are listed below:\n- Getting information about the player, his equipment and medals.\n- Obtaining information about the clan.\n- Getting information about vehicles.\n- *And other methods.*\n\n## Copyright Notice\n\n<a href=\"https://developers.lesta.ru/\"><img src=\"docs/icons/lesta_logo.png\" width=\"178px\" style=\"margin: 20px;\"></a>\u00a0<a href=\"https://developers.wargaming.net/\"><img src=\"docs/icons/wg_logo.png\" width=\"150px\" style=\"margin: 20px;\"></a>\n\n- 2024 \u00a9 Alexander Podstrechnyy. \n    - [tankalxat34@gmail.com](mailto:tankalxat34@gmail.com?subject=lestagamesapi)\n    - [VKontakte](https://vk.com/tankalxat34)\n    - [Telegram](https://tankalxat34.t.me)\n    - [GithHub](https://github.com/tankalxat34/wglestaapi)\n- 2024 \u00a9 Wargaming.net. All rights reserved.\n    - [User Support Center](http://support.wargaming.net/)\n    - [Official website](https://wargaming.net/)\n    - [License Agreement](https://eu.wargaming.net/user_agreement/)\n    - [Privacy Policy](https://eu.wargaming.net/privacy_policy/)\n- 2024 \u00a9 Lesta Games. All rights reserved. \n    - [User Support Center](https://lesta.ru/support/)\n    - [Official website](https://lesta.ru/)\n    - [License Agreement](https://developers.lesta.ru/documentation/rules/agreement/)\n    - [Privacy Policy](https://legal.lesta.ru/privacy-policy/)\n\n*This program code is not a product of Lesta Games and was developed according to Lesta Games DPP rules.*\n\n*This program code is not a product of Wargaming.net and is developed according to WG DPP rules.*\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Unofficial Python library that implements the Wargaming.net API and Lesta Games API functionality",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/tankalxat34/WgLestaAPI",
        "Repository": "https://github.com/tankalxat34/WgLestaAPI"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b907f129ec3ab55b8f1df4a00c1bf446dfb27f83fd5fc04f2d2773d88dfb11a",
                "md5": "888c69c63e90773898e9e21c594e8dbc",
                "sha256": "b8084a342f982047ce10de41036d5e1399a7ba21e8958decc50f854f79bf8af0"
            },
            "downloads": -1,
            "filename": "wglestaapi-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "888c69c63e90773898e9e21c594e8dbc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.6",
            "size": 9805,
            "upload_time": "2024-06-26T09:15:21",
            "upload_time_iso_8601": "2024-06-26T09:15:21.789002Z",
            "url": "https://files.pythonhosted.org/packages/1b/90/7f129ec3ab55b8f1df4a00c1bf446dfb27f83fd5fc04f2d2773d88dfb11a/wglestaapi-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb9b75c595cd82e857b4a8e067e48279adebb2f4c8f53d0887fc8fe4c4dcacc2",
                "md5": "41e6441ef0fe7120627baa3a75444875",
                "sha256": "0ee5b39a5d3640c84559632c5c50d97a69809568ada76655c63b9193367466c0"
            },
            "downloads": -1,
            "filename": "wglestaapi-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "41e6441ef0fe7120627baa3a75444875",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.6",
            "size": 9013,
            "upload_time": "2024-06-26T09:15:34",
            "upload_time_iso_8601": "2024-06-26T09:15:34.921270Z",
            "url": "https://files.pythonhosted.org/packages/eb/9b/75c595cd82e857b4a8e067e48279adebb2f4c8f53d0887fc8fe4c4dcacc2/wglestaapi-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-26 09:15:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tankalxat34",
    "github_project": "WgLestaAPI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "wglestaapi"
}
        
Elapsed time: 0.30751s