Skip to main content

A Python written wrapper for the Tanki Online game API

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Notification

This project was created just to exist. Of course, I will update it when the API itself changes, but not immediately. Well, if You want to support this project, You can give it a star.

Information

As mentioned earlier, this project is created just to exist. And so, the module itself is needed to get the top of players and get information about the player separately. If You know more functionality of the API of the game Tanki Online, then please report this functionality in the Issues.

Features
  • Fully async/await
  • Getting top of players
  • Getting information of any player by him name
  • Getting status of stable server Maybe deprecated
  • Getting status of test servers

Installing

Python 3.8 or higher is required

To install a non-speedup version of the library, do the following:

# Linux/macOS
python3 -m pip install -U tankioapi

# Windows
py -3 -m pip install -U tankioapi

Or, to install the speedup version, do the following:

# Linux/macOS
python3 -m pip install -U "tankioapi[speedup]"

# Windows
py -3 -m pip install -U tankioapi[speedup]

And, to install the development version, do the following:

$ git clone https://github.com/stngularity/tankioapi
$ cd tankioapi
$ python3 -m pip install -U .[speedup]

Examples

Here are examples of some of the features of the library. More examples in examples/

Getting all tops of players
import asyncio
from toapi import Top, TopLists, get_tops

tops: TopLists = asyncio.run(get_tops())
efficiency_top: Top = tops.efficiency
print("----- Efficiency top -----")
for number, user in enumerate(efficiency_top.users):
    print(f"#{number+1}   {user.name} ({user.top_value})")
Getting information of player
import asyncio
from toapi import User, get_user

user: User = asyncio.run(get_user("sty"))
# and You can specify language
# user: User = asyncio.run(get_user("sty", lang="ru"))

print(f"Name: {user.name}")
rank: str = user.rank.name.title()
print(f"Rank: {rank} ({user.score}/{user.score_next} {round(user.score/user.score_next*100)}%)")
print(f"Has premium: {'Yes' if user.premium else 'No'}")
print()
print(f"KD: {user.kills}/{user.deaths} ({user.kd_ratio})")
print(f"Caught golds: {user.caught_golds}")
print(f"Crystals: {user.crystals}")
print(f"GS: {user.gear_score}")

License

This project is distributed under the MIT license. You can learn more from the LICENSE file.

Made with ❤ and 🍵 by stngularity for everyone

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

tankioapi-1.0.1.tar.gz (13.8 kB view details)

Uploaded Source

File details

Details for the file tankioapi-1.0.1.tar.gz.

File metadata

  • Download URL: tankioapi-1.0.1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for tankioapi-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6533d175759492eba53af14807ec5a254bb53f69135f97c0bce29a4bc6704026
MD5 7d37acc39ab6ed47a1ca78fef6defdbd
BLAKE2b-256 1eb6dfa3d6f89e48a4723f66e95a99ec844fd49453b825c3f03f9a613cae2624

See more details on using hashes here.

Supported by

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