Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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

Release files for callofduty.py 1.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 callofduty.py 1.4.0
File Size Uploaded
callofduty.py-1.4.0.tar.gz 21.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for callofduty.py 1.4.0
File Interpreter ABI Platform
callofduty.py-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.4 kB

Release files / callofduty.py-1.4.0.tar.gz

Download URL callofduty.py-1.4.0.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f1d0c70bc659f6b1aa3d5af701143c1df2cba1f6ac1227fbae1ecb44e4afc729
BLAKE2b-256 checksum
How to use checksums
bf877d71093c9bd23cd534f405f4e1f955324fccdc9c7974374c7247b56ed5c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Windows/10

Release files / callofduty.py-1.4.0-py3-none-any.whl

Download URL callofduty.py-1.4.0-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9394b03dda157a3e9a1c1e4d5c9346793cff5370a575f8c224ac302f8e3c607a
BLAKE2b-256 checksum
How to use checksums
2115ae4d181c21350b6b847ed0b43f69f22102ed1af3a6508f06982cbe869a17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Windows/10
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