Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EthanC/CallofDuty.py
Asynchronous, object-oriented Python wrapper for the Call of Duty API.
https://github.com/EthanC/CallofDuty.py
api async asynchronous black-ops call-of-duty call-of-duty-py callofduty cod cold-war companion-app httpx infinite-warfare modern-warfare my-callofduty object-oriented python python-3 rest wrapper wwii
Last synced: 3 months ago
JSON representation
Asynchronous, object-oriented Python wrapper for the Call of Duty API.
- Host: GitHub
- URL: https://github.com/EthanC/CallofDuty.py
- Owner: EthanC
- License: mit
- Archived: true
- Created: 2019-11-17T02:44:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-28T08:33:52.000Z (almost 3 years ago)
- Last Synced: 2024-05-02T03:53:08.791Z (7 months ago)
- Topics: api, async, asynchronous, black-ops, call-of-duty, call-of-duty-py, callofduty, cod, cold-war, companion-app, httpx, infinite-warfare, modern-warfare, my-callofduty, object-oriented, python, python-3, rest, wrapper, wwii
- Language: Python
- Homepage:
- Size: 184 KB
- Stars: 90
- Watchers: 16
- Forks: 24
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - EthanC/CallofDuty.py - Asynchronous, object-oriented Python wrapper for the Call of Duty API. (Python)
README
# 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](https://www.python.org/dev/peps/pep-0484/)
- 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```py
import asyncioimport callofduty
from callofduty import Mode, Platform, Titleasync def main():
client = await callofduty.Login("[email protected]", "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](https://semver.org/) for tagging releases of the project.
Changelogs can be found on the [Releases](https://github.com/EthanC/CallofDuty.py/releases) page and follow the [Keep a Changelog](https://keepachangelog.com/) 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`](https://github.com/EthanC/CallofDuty.py/blob/master/.github/CONTRIBUTING.md) for details.
## Thanks & Credits
- [Tustin](https://github.com/Tustin) - Call of Duty API Authorization Flow
- [Activision](https://www.activision.com/) - Call of Duty Logo & API Service