Skip to main content

CallofDuty.py is an asynchronous, object-oriented Python wrapper for the Call of Duty API.

Project description

CallofDuty.py

CallofDuty.py

CallofDuty.py is an asynchronous, object-oriented Python wrapper for the Call of Duty API.

Features

  • Asynchronous and Pythonic using async and await
  • Type checks and editor completion using Type Hints
  • Object-oriented and predictable abstractions

Usage

Construct a new Call of Duty client, then use the various services on the client to access different parts of the Call of Duty API.

Installation

CallofDuty.py requires Python 3.10 or greater. Once this requirement is met, simply install CallofDuty.py!

pip install callofduty.py

# or

poetry add callofduty.py

Example

The following is a complete example which demonstrates:

  • Authenticating with the Call of Duty API
  • Searching for a user
  • Listing the first 3 search results
  • Getting the Modern Warfare Multiplayer profile of the second result
  • Displaying their basic statistics
import asyncio

import callofduty
from callofduty import Mode, Platform, Title


async def main():
    client = await callofduty.Login("YourEmail@email.com", "YourPassword")

    results = await client.SearchPlayers(Platform.Activision, "Captain Price", limit=3)
    for player in results:
        print(f"{player.username} ({player.platform.name})")

    me = results[1]
    profile = await me.profile(Title.ModernWarfare, Mode.Multiplayer)

    level = profile["level"]
    kd = profile["lifetime"]["all"]["properties"]["kdRatio"]
    wl = profile["lifetime"]["all"]["properties"]["wlRatio"]

    print(f"\n{me.username} ({me.platform.name})")
    print(f"Level: {level}, K/D Ratio: {kd}, W/L Ratio: {wl}")

asyncio.get_event_loop().run_until_complete(main())

Releases

CallofDuty.py follows Semantic Versioning for tagging releases of the project.

Changelogs can be found on the Releases page and follow the Keep a Changelog format.

Contributing

The goal is to cover the entirety of the Call of Duty API, so contributions are always welcome. The calling pattern is pretty well-established, so adding new methods is relatively straightforward. See CONTRIBUTING.md for details.

Thanks & Credits

  • Tustin - Call of Duty API Authorization Flow
  • Activision - Call of Duty Logo & API Service

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

callofduty.py-1.4.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

callofduty.py-1.4.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file callofduty.py-1.4.0.tar.gz.

File metadata

  • Download URL: callofduty.py-1.4.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Windows/10

File hashes

Hashes for callofduty.py-1.4.0.tar.gz
Algorithm Hash digest
SHA256 f1d0c70bc659f6b1aa3d5af701143c1df2cba1f6ac1227fbae1ecb44e4afc729
MD5 7f5a79ba78dcb55d1ca61db0074626a3
BLAKE2b-256 bf877d71093c9bd23cd534f405f4e1f955324fccdc9c7974374c7247b56ed5c4

See more details on using hashes here.

File details

Details for the file callofduty.py-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: callofduty.py-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Windows/10

File hashes

Hashes for callofduty.py-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9394b03dda157a3e9a1c1e4d5c9346793cff5370a575f8c224ac302f8e3c607a
MD5 b0b9359c6d122eca8eed3153b0cc661c
BLAKE2b-256 2115ae4d181c21350b6b847ed0b43f69f22102ed1af3a6508f06982cbe869a17

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