Skip to main content

Python wrapper for the COD API (Warzone) as well as wzstats.gg, with some useful functions to process and parse the stat responses.

Project description

WarzoneStats

WarzoneStats is a Python wrapper for the COD Warzone Api (https://documenter.getpostman.com/view/5519582/SzzgAefq). There is an additional wrapper for the https://wzstats.gg/ website. There are also some helpful functions to extract useful data from the api responses.

Installation

Use the package manager pip to install WarzoneStats.

pip3 install WarzoneStats

Usage

Before using the COD Api you first need to login to Activision and get the ACT_SSO_COOKIE

You can do this in Chrome by going into inspect element -> Application tab -> Cookies -> enter ACT_SSO_COOKIE into the filter field

Copy and save this value to use in the package

You should be caching the return values from both Api and ApiGG so you don't keep sending the same request and end up getting ip banned

COD Api

from WarzoneStats import Api

username = 'huskerrs#1343'

# Can see the platform values by referencing Api.Platforms
platform = 'battle' 

sso = 'Get this value from the ACT_SSO_COOKIE that is set in Chrome by logging into activision.com'

api = Api(username, platform, sso)

# You can view all sample responses in the Sample Endpoint Responses Folder

# This endpoint returns lifetime stats like kd, gun accuracy, weekly stats, etc
profile = api.get_profile()
print(profile['data']['lifetime']['all']['properties']['kdRation'])

# This endpoint returns 20 recent matches with everything from team name, team placement to the loadouts everyone used
recentMatches = api.get_recentMatches()	
print(recentMatches['data']['summary']['all']['kills'])

# Returns 1000 recent matches, with only the timestamps, matchIds, mapId, and platform
# Useful for using matchIds to get stats of that match (lobby kd etc)
matches = api.get_matches()
matchId = recentMatches['data'][0]['matchId']
print(matchId)

# Returns the details of the specific match per player; each players stats from the loadout they used to the kills they got is listed
matchDetails = api.get_matchDetails(matchId)
print(matchDetails['data']['allPlayers'][0]['player']['username'])

wzstats.gg

from WarzoneStats import ApiGG

username = 'nrg joewo#2631118'
platform = 'acti'

api = ApiGG()

stats = api.get_stats(username, platform)
print(stats)

parser

from WarzoneStats import ApiGG, ParserGG

username = 'nrg joewo#2631118'
platform = 'acti'

api = ApiGG()

stats = api.get_stats(username, platform)

parser = ParserGG()

print(parser.get_average_kd_lobbies(stats))

''' and '''

# Get this from either Api or ApiGG response
match_id = '6702851451945654660'

match = api.get_match(match_id)

print(parser.get_average_lobby_kd(match)

License

MIT

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

WarzoneStats-0.1.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

WarzoneStats-0.1.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file WarzoneStats-0.1.2.tar.gz.

File metadata

  • Download URL: WarzoneStats-0.1.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for WarzoneStats-0.1.2.tar.gz
Algorithm Hash digest
SHA256 dc27ca9f0395ccb389eed6a42e915faae09a17e80846cfb5ae5b479d24fbdbf0
MD5 21303768f9923eb70f902b474e4efb95
BLAKE2b-256 e8aeed6829a036da76775cadcbde814b97bcf0658e76a9f216e7a771fabef4aa

See more details on using hashes here.

File details

Details for the file WarzoneStats-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: WarzoneStats-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for WarzoneStats-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89bb10b7f09ac7656c1243eccf6af400dd094d17e330ca60b04b446afcafef0a
MD5 b967737e5d3c80b97cfc518f99f6912e
BLAKE2b-256 6622cbba8316da84d6afdaf2ebdd6c201ebb6a8c45dafa13da9e2c6609511046

See more details on using hashes here.

Supported by

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