Skip to main content

A Python World of Warships API wrapper

Project description

# Warships.py
A Python3 World of Warships API wrapper

Installation instruction:
``pip install wowspy``

Please consult the official documentation [here](https://developers.wargaming.net/reference)

Example usage:
```py
from wowspy import Wows


def example():
api_key = 'YOUR_WOWS_API_KEY'
my_api = Wows(api_key)

# We will search for a player and then get its stats in this example
player_name = 'PotatoSquad'

# Api response from Wargaming
# We only want one result, thus it's specified limit
player_id_response = my_api.players(
my_api.region.NA, player_name, fields='account_id', limit=1)

# Get the player id from the api response
player_id = player_id_response['data'][0]['account_id']

# Now we will use this id to search for the player's stats
# We only want the pvp stats here, it's specified in fields param
player_stats_response = my_api.player_personal_data(
my_api.region.NA, player_id, fields='statistics.pvp')
print(player_stats_response)


if __name__ == '__main__':
example()
```

Example usage(with Aiohttp):
```py
from asyncio import get_event_loop

from aiohttp import ClientSession

from wowspy import WowsAsync


async def example():
api_key = 'YOUR_WOWS_API_KEY'
session = ClientSession()
my_api = WowsAsync(api_key, session)

# We will search for a player and then get its stats in this example
player_name = 'PotatoSquad'

# Api response from Wargaming
# We only want one result, thus it's specified limit
player_id_response = await my_api.players(
my_api.region.NA, player_name, fields='account_id', limit=1)

# Get the player id from the api response
player_id = player_id_response['data'][0]['account_id']

# Now we will use this id to search for the player's stats
# We only want the pvp stats here, it's specified in fields param
player_stats_response = await my_api.player_personal_data(
my_api.region.NA, player_id, fields='statistics.pvp')
print(player_stats_response)


if __name__ == '__main__':
loop = get_event_loop()
loop.run_until_complete(example())
loop.close()

```

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

wowspy-1.2.3.tar.gz (11.8 kB view details)

Uploaded Source

File details

Details for the file wowspy-1.2.3.tar.gz.

File metadata

  • Download URL: wowspy-1.2.3.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wowspy-1.2.3.tar.gz
Algorithm Hash digest
SHA256 aea0565ceb728cfdea98c15eb9c26f67ab7f258113617e15f23f6f81cab08b03
MD5 ee6a12ec58cb6159ead624e09f192bf4
BLAKE2b-256 c7084fd9d791ce4a76e80769f7a576bdb4bea45ee7237184732f48a9bc36a6df

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