Skip to main content

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

This project has been archived.

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

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.8 or greater. Once this requirement is met, simply install CallofDuty.py using pip (or Poetry)!

pip install 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}")

    await client.Logout()

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.0.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

callofduty.py-1.0.1-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: callofduty.py-1.0.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.8.1 Windows/10

File hashes

Hashes for callofduty.py-1.0.1.tar.gz
Algorithm Hash digest
SHA256 becd9f26f3d07bb75a6e06d3cdf341f9d765e8bc01a72d86ee506aca4445e868
MD5 655e37dc0ed82cfbf33e1b3e30848ef6
BLAKE2b-256 a67ed536110f126b2ce8cacb1651019a6319b8df141e6b0cf9f089d3e608f92f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: callofduty.py-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.8.1 Windows/10

File hashes

Hashes for callofduty.py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea12c423f8b445c86985020aea5b1723b12849428ec1e9933635a21efb86d89e
MD5 8169a8016e2431482d8ae35d0dacbbc2
BLAKE2b-256 8ec3fefef27af63311735e90ad979dab310a67afb969a1c3bafacd81b3a0632f

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