Skip to main content

WT Profile Tool

Open in Dev Containers Lint Test Publish to PyPI and TestPyPI codecov

Description

This package contains set of tools used to to fetch War Thunder profiles, including:

  • Get user profile by ID
  • Get user ID by nick
  • etc...

All data comes from public API.

IMPORTANT: This project is NOT affiliated with Gaijin Entertainment in any way, but is built by developers in the War Thunder community who love War Thunder. If it infringes upon your rights, please contact author.

Many thanks to @RaidFourms for his immense help which inspired this project.

Not a python developer?

You can use API server directly by RaidFourms's wtpt-api project.

Don't know how to use API server?

Well, this is a tool project and not intended for non-developers 😵😵😵

Usage

Install

You can easily install it with pip:

pip install wt-profile-tool

Or you can install it with Poetry:

poetry add wt-profile-tool

Initialize the tool

you can simply import the class and use it like the following

from wt_profile_tool import WTPTClient

client = WTPTClient()

Or you can customize the client, for example, you want to set all request timeout to 30 seconds

client = WTPTClient(
        http_client=httpx.Client(timeout=httpx.Timeout(30.0)),
)

You can customize the http_client to enable proxy, headers, etc.

Random user agent when sending request?

client = WTPTClient(random_ua=True)

For more information about the parameters, please refer to the client description.

For old version

WTProfileTool is still available, but it is not recommended to use it. it has been makred deprecated and will be removed in the future. You can simply import the class and use it like the following

from wt_profile_tool import WTProfileTool

wtpt = WTProfileTool()

...

Get player's userid by nickname prefix

After you initialize the tool, you can use client's method to get player's userid by nickname prefix.

# This guy is real exist
data = client.get_player_userid_by_prefix_nick("OnTheRocks")

Note: Every time you call a method needs to send http request, it will send a request to a War Thunder server. Make sure your network can access the server and DO NOT ABUSE IT.

Get player's profile by userid

After you have the userid, you can use another method to get player's profile.

# This guy is OnTheRocks
profile = client.get_player_profile_by_userid("5363987")

Then, you can do something with the profile.

base_info = profile.base_info

nick = base_info.nick

profile is a Pydantic V2 BaseModel, you can use profile.model_dump_json() to get the json string if you like.

profile_json = profile.model_dump_json()

A JSON string should look like the following:

{
  "base_info": {
    "user_id": "",
    "nick": "OnTheRocks",
    "icon_id": null,
    "title": "Tank Destroyer",
    "clan_id": null,
    "clan_tag": null,
    "clan_type": null,
    "clan_name": null,
    "clan_member_role": null
  },
  "level_info": {
    "level": 100,
    "exp_has": 27169491,
    "exp_left": 27169491,
    "completeness": 4.6071824188000174e18
  },
  "lang": "en",
  "battle_list": []
}

NOTE: Data seems broken or missmatch? Please open an issue and provide a right example.

Maybe you want to know why I use player OnTheRocks as an example. Because he was a cheater. I reported him and he was banned. This is the price you pay for using cheats to kill me 5 times in one battle. 😡😡😡

More features?

You can refer to the WTPTClient's descritpion to find more available methods.

Contributing

If you have any issues or suggestions feel free to open one.

Pull requests are welcome.

For major changes, please open an issue first to discuss what you would like to change.

License

MIT License

Metadata

Release files for wt-profile-tool 0.4.0

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

Source distribution (sdist)

Source distribution for wt-profile-tool 0.4.0
File Size Uploaded
wt_profile_tool-0.4.0.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wt-profile-tool 0.4.0
File Interpreter ABI Platform
wt_profile_tool-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / wt_profile_tool-0.4.0.tar.gz

Download URL wt_profile_tool-0.4.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7f83f406d86f724fbda532c543f939544387ffb5a8ec13932cb971b3f956150e
BLAKE2b-256 checksum
How to use checksums
dd3a319317dee46a22147aef397f63bad154598fbb2609f03559477e50ea513c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / wt_profile_tool-0.4.0-py3-none-any.whl

Download URL wt_profile_tool-0.4.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40e67e229ba05e4621c8eac6995045db219e97d7f2001bf4d13c4148cc730e7a
BLAKE2b-256 checksum
How to use checksums
f94879dbc261591d87b3bc89f9ef09377d60956be5b2cd8f154d5d01f3304013
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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