├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── codeql-analysis.yml │ ├── python-app.yml │ └── python-publish.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.rst ├── LICENSE ├── README.rst ├── cod_api └── __init__.py ├── reuirements_dev.txt ├── setup.cfg └── setup.py /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: TodoLodo 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: ['https://www.buymeacoffee.com/todolodo2089', 'https://www.paypal.com/paypalme/engineer15'] 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "integration" 13 | 14 | on: 15 | push: 16 | branches: [ "main" ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ "main" ] 20 | schedule: 21 | - cron: '23 11 * * 1' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'python' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | 52 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 53 | # queries: security-extended,security-and-quality 54 | 55 | 56 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 57 | # If this step fails, then you should remove it and run the build manually (see below) 58 | - name: Autobuild 59 | uses: github/codeql-action/autobuild@v2 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 63 | 64 | # If the Autobuild fails above, remove it and uncomment the following three lines. 65 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. 66 | 67 | # - run: | 68 | # echo "Run, Build Application using script" 69 | # ./location_of_script_within_repo/buildscript.sh 70 | 71 | - name: Perform CodeQL Analysis 72 | uses: github/codeql-action/analyze@v2 73 | -------------------------------------------------------------------------------- /.github/workflows/python-app.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a single version of Python 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions 3 | 4 | name: Python application 5 | 6 | on: 7 | push: 8 | branches: [ "main" ] 9 | pull_request: 10 | branches: [ "main" ] 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | build: 17 | 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | - name: Set up Python 3.10 23 | uses: actions/setup-python@v3 24 | with: 25 | python-version: "3.10" 26 | - name: Install dependencies 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install flake8 pytest 30 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 31 | - name: Lint with flake8 32 | run: | 33 | # stop the build if there are Python syntax errors or undefined names 34 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 35 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 36 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 37 | -------------------------------------------------------------------------------- /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package using Twine when a release is created 2 | # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: integration 10 | 11 | on: 12 | release: 13 | types: [published] 14 | 15 | permissions: 16 | contents: read 17 | 18 | jobs: 19 | deploy: 20 | 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - uses: actions/checkout@v3 25 | - name: Set up Python 26 | uses: actions/setup-python@v3 27 | with: 28 | python-version: '3.x' 29 | - name: Install dependencies 30 | run: | 31 | python -m pip install --upgrade pip 32 | python -m pip install -U twine 33 | python -m pip install -U wheel 34 | - name: Build package 35 | run: python setup.py sdist bdist_wheel 36 | - name: Publish package 37 | run: twine upload dist/* -u TodoLodo -p ${{ secrets.PYPI_API_PASSWORD }} 38 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | me@todolodo.xyz. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | Contributing to Transcriptase 2 | ============================= 3 | We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: 4 | 5 | - Reporting a bug 6 | - Discussing the current state of the code 7 | - Submitting a fix 8 | - Proposing new features 9 | - Becoming a maintainer 10 | 11 | We Develop with Github 12 | ---------------------- 13 | We use github to host code, to track issues and feature requests, as well as accept pull requests. 14 | 15 | We Use `Github Flow `_, So All Code Changes Happen Through Pull Requests 16 | -------------------------------------------------------------------------------------------------------------------------------- 17 | Pull requests are the best way to propose changes to the codebase (we use `Github Flow `_). We actively welcome your pull requests: 18 | 19 | 1. Fork the repo and create your branch from `main`. 20 | 2. If you've added code that should be tested, add tests. 21 | 3. If you've changed APIs, update the documentation. 22 | 4. Ensure the test suite passes. 23 | 5. Make sure your code lints. 24 | 6. Issue that pull request! 25 | 26 | Any contributions you make will be under the GNU General Public License (`GPL `_) 27 | ------------------------------------------------------------------------------------------------------------------------------- 28 | In short, when you submit code changes, your submissions are understood to be under the same GPL-3.0 license that covers the project. Feel free to contact the maintainers if that's a concern. 29 | 30 | Report bugs using Github's `issues `_ 31 | -------------------------------------------------------------------------------------------- 32 | We use GitHub issues to track public bugs. Report a bug by `opening a new issue `_ 33 | 34 | Write bug reports with detail, background, and sample code 35 | ---------------------------------------------------------- 36 | **Great Bug Reports** tend to have: 37 | 38 | - A quick summary and/or background 39 | - Steps to reproduce 40 | - Be specific! 41 | - Give sample code if you can. 42 | - What you expected would happen 43 | - What actually happens 44 | - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) 45 | 46 | People *love* thorough bug reports. I'm not even kidding. 47 | 48 | Use a Consistent Coding Style 49 | ----------------------------- 50 | 51 | * 4 spaces or tabs for indentation 52 | * Use reasonable and understandable variable names 53 | * Use proper error handling 54 | * Add comments where necessary 55 | * You can try running `pylint example.py` for style unification 56 | 57 | License 58 | ------- 59 | By contributing, you agree that your contributions will be licensed under its GPL-3.0 license. 60 | 61 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- 62 | 63 | References 64 | ---------- 65 | This document was adapted from a gist by `briandk `_ 66 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (__C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (__C) 2022 Todo Lodo 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | cod-api Copyright (__C) 2022 Todo Lodo & Engineer15 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | **cod-python-api** 3 | =================== 4 | 5 | .. meta:: 6 | :description: Call Of Duty API Library for python with the implementation of both public and private API used by activision on callofduty.com 7 | :key: CallOfDuty API, CallOfDuty python API, CallOfDuty python 8 | 9 | .. image:: https://github.com/TodoLodo/cod-python-api/actions/workflows/codeql-analysis.yml/badge.svg?branch=main 10 | :target: https://github.com/TodoLodo/cod-python-api.git 11 | 12 | .. image:: https://img.shields.io/endpoint?url=https://cod-python-api.todolodo.xyz/stats?q=version 13 | :target: https://badge.fury.io/py/cod-api 14 | 15 | .. image:: https://img.shields.io/endpoint?url=https://cod-python-api.todolodo.xyz/stats?q=downloads 16 | :target: https://badge.fury.io/gh/TodoLodo2089%2Fcod-python-api 17 | 18 | ------------------------------------------------------------------------------------------------------------------------ 19 | 20 | **Call Of Duty API Library** for **python** with the implementation of both public and private API used by activision on 21 | callofduty.com 22 | 23 | ==== 24 | Devs 25 | ==== 26 | * `Todo Lodo`_ 27 | * `Engineer15`_ 28 | 29 | .. _Todo Lodo: https://todolodo.xyz 30 | .. _Engineer15: https://github.com/Engineer152 31 | 32 | ============ 33 | Contributors 34 | ============ 35 | * `Werseter`_ 36 | 37 | .. _Werseter: https://github.com/Werseter 38 | 39 | =============== 40 | Partnered Code 41 | =============== 42 | `Node-CallOfDuty`_ by: `Lierrmm`_ 43 | 44 | .. _Node-CallOfDuty: https://github.com/Lierrmm/Node-CallOfDuty 45 | .. _Lierrmm: https://github.com/Lierrmm 46 | 47 | ============= 48 | Documentation 49 | ============= 50 | This package can be used directly as a python file or as a python library. 51 | 52 | Installation 53 | ============ 54 | 55 | Install cod-api library using `pip`_: 56 | 57 | .. code-block:: bash 58 | 59 | pip install -U cod-api 60 | 61 | .. _pip: https://pip.pypa.io/en/stable/getting-started/ 62 | 63 | Usage 64 | ===== 65 | 66 | Initiation 67 | ---------- 68 | 69 | Import module with its classes: 70 | 71 | .. code-block:: python 72 | 73 | from cod_api import API 74 | 75 | api = API() 76 | 77 | 78 | .. _`logged in`: 79 | 80 | Login with your sso token: 81 | 82 | .. code-block:: python 83 | 84 | api.login('Your sso token') 85 | 86 | Your sso token can be found by longing in at `callofduty`_, opening dev tools (ctr+shift+I), going to Applications > 87 | Storage > Cookies > https://callofduty.com, filter to search 'ACT_SSO_COOKIE' and copy the value. 88 | 89 | .. _callofduty: https://my.callofduty.com/ 90 | 91 | Game/Other sub classes 92 | ---------------------- 93 | 94 | Following importation and initiation of the class ``API``, its associated subclasses can be called by 95 | ``API.subClassName``. 96 | 97 | Below are the available sub classes: 98 | 99 | +-------------------+----------+ 100 | | sub class | category | 101 | +===================+==========+ 102 | |* `ColdWar`_ | game | 103 | +-------------------+----------+ 104 | |* `ModernWarfare`_ | game | 105 | +-------------------+----------+ 106 | |* `ModernWarfare2`_| game | 107 | +-------------------+----------+ 108 | |* `Vanguard`_ | game | 109 | +-------------------+----------+ 110 | |* `Warzone`_ | game | 111 | +-------------------+----------+ 112 | |* `Warzone2`_ | game | 113 | +-------------------+----------+ 114 | |* `Me`_ | other | 115 | +-------------------+----------+ 116 | |* `Shop`_ | other | 117 | +-------------------+----------+ 118 | |* `Misc`_ | other | 119 | +-------------------+----------+ 120 | 121 | 122 | 123 | For a detailed description, ``__doc__`` (docstring) of each sub class can be called as shown below: 124 | 125 | .. _`ColdWar`: 126 | 127 | ``ColdWar``: 128 | 129 | .. code-block:: python 130 | 131 | from cod_api import API 132 | 133 | api = API() 134 | 135 | # print out the docstring 136 | print(api.ColdWar.__doc__) 137 | 138 | .. _`ModernWarfare`: 139 | 140 | ``ModernWarfare``: 141 | 142 | .. code-block:: python 143 | 144 | from cod_api import API 145 | 146 | api = API() 147 | 148 | # print out the docstring 149 | print(api.ModernWarfare.__doc__) 150 | 151 | .. _`ModernWarfare2`: 152 | 153 | ``ModernWarfare2``: 154 | 155 | .. code-block:: python 156 | 157 | from cod_api import API 158 | 159 | api = API() 160 | 161 | # print out the docstring 162 | print(api.ModernWarfare2.__doc__) 163 | 164 | .. _`Vanguard`: 165 | 166 | ``Vanguard``: 167 | 168 | .. code-block:: python 169 | 170 | from cod_api import API 171 | 172 | api = API() 173 | 174 | # print out the docstring 175 | print(api.Vanguard.__doc__) 176 | 177 | .. _`Warzone`: 178 | 179 | ``Warzone``: 180 | 181 | .. code-block:: python 182 | 183 | from cod_api import API 184 | 185 | api = API() 186 | 187 | # print out the docstring 188 | print(api.Warzone.__doc__) 189 | 190 | .. _`Warzone2`: 191 | 192 | ``Warzone2``: 193 | 194 | .. code-block:: python 195 | 196 | from cod_api import API 197 | 198 | api = API() 199 | 200 | # print out the docstring 201 | print(api.Warzone2.__doc__) 202 | 203 | .. _`Me`: 204 | 205 | ``Me``: 206 | 207 | .. code-block:: python 208 | 209 | from cod_api import API 210 | 211 | api = API() 212 | 213 | # print out the docstring 214 | print(api.Me.__doc__) 215 | 216 | .. _`Shop`: 217 | 218 | ``Shop``: 219 | 220 | .. code-block:: python 221 | 222 | from cod_api import API 223 | 224 | api = API() 225 | 226 | # print out the docstring 227 | print(api.Shop.__doc__) 228 | 229 | 230 | .. _`Misc`: 231 | 232 | ``Misc``: 233 | 234 | .. code-block:: python 235 | 236 | from cod_api import API 237 | 238 | api = API() 239 | 240 | # print out the docstring 241 | print(api.Misc.__doc__) 242 | 243 | Full Profile History 244 | -------------------- 245 | 246 | Any sub class of ``API`` that is of game category, has methods to check a player's combat history. 247 | Note that before calling any sub class methods of ``API`` you must be `logged in`_. 248 | Main method is ``fullData()`` and ``fullDataAsync()`` which is available for ``ColdWar``, ``ModernWarfare``, 249 | ``ModernWarfare2``, ``Vanguard``, ``Warzone`` and ``Warzone2`` classes. 250 | 251 | Here's an example for retrieving **Warzone** full profile history of a player whose gamer tag is **Username#1234** on platform 252 | **Battlenet**: 253 | 254 | .. code-block:: python 255 | 256 | from cod_api import API, platforms 257 | import asyncio 258 | 259 | ## sync 260 | # initiating the API class 261 | api = API() 262 | 263 | # login in with sso token 264 | api.login('your_sso_token') 265 | 266 | # retrieving combat history 267 | profile = api.Warzone.fullData(platforms.Battlenet, "Username#1234") # returns data of type dict 268 | 269 | # printing results to console 270 | print(profile) 271 | 272 | ## async 273 | # in an async function 274 | async def example(): 275 | # login in with sso token 276 | await api.loginAsync('your_sso_token') 277 | 278 | # retrieving combat history 279 | profile = await api.Warzone.fullDataAsync(platforms.Battlenet, "Username#1234") # returns data of type dict 280 | 281 | # printing results to console 282 | print(profile) 283 | 284 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 285 | 286 | 287 | Combat History 288 | -------------- 289 | 290 | Main methods are ``combatHistory()`` and ``combatHistoryWithDate()`` for sync environments and ``combatHistoryAsync()`` 291 | and ``combatHistoryWithDateAsync()`` for async environments which are available for all ``ColdWar``, ``ModernWarfare``, 292 | ``ModernWarfare2``, ``Vanguard``, ``Warzone`` and ``Warzone2`` classes. 293 | 294 | The ``combatHistory()`` and ``combatHistoryAsync()`` takes 2 input parameters which are ``platform`` and ``gamertag`` of 295 | type `cod_api.platforms`_ and string respectively. 296 | 297 | Here's an example for retrieving **Warzone** combat history of a player whose gamer tag is **Username#1234** on platform 298 | **Battlenet**: 299 | 300 | .. code-block:: python 301 | 302 | from cod_api import API, platforms 303 | 304 | # initiating the API class 305 | api = API() 306 | 307 | ## sync 308 | # login in with sso token 309 | api.login('your_sso_token') 310 | 311 | # retrieving combat history 312 | hist = api.Warzone.combatHistory(platforms.Battlenet, "Username#1234") # returns data of type dict 313 | 314 | # printing results to console 315 | print(hist) 316 | 317 | ## async 318 | # in an async function 319 | async def example(): 320 | # login in with sso token 321 | await api.loginAsync('your_sso_token') 322 | 323 | # retrieving combat history 324 | hist = await api.Warzone.combatHistoryAsync(platforms.Battlenet, "Username#1234") # returns data of type dict 325 | 326 | # printing results to console 327 | print(hist) 328 | 329 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 330 | 331 | The ``combatHistoryWithDate()`` and ``combatHistoryWithDateAsync()`` takes 4 input parameters which are ``platform``, 332 | ``gamertag``, ``start`` and ``end`` of type `cod_api.platforms`_, string, int and int respectively. 333 | 334 | ``start`` and ``end`` parameters are utc timestamps in microseconds. 335 | 336 | Here's an example for retrieving **ModernWarfare** combat history of a player whose gamer tag is **Username#1234567** on 337 | platform **Activision** with in the timestamps **1657919309** (Friday, 15 July 2022 21:08:29) and **1657949309** 338 | (Saturday, 16 July 2022 05:28:29): 339 | 340 | .. code-block:: python 341 | 342 | from cod_api import API, platforms 343 | 344 | # initiating the API class 345 | api = API() 346 | 347 | ## sync 348 | # login in with sso token 349 | api.login('your_sso_token') 350 | 351 | # retrieving combat history 352 | hist = api.Warzone.combatHistoryWithDate(platforms.Activision, "Username#1234567", 1657919309, 1657949309) # returns data of type dict 353 | 354 | # printing results to console 355 | print(hist) 356 | 357 | ## async 358 | # in an async function 359 | async def example(): 360 | # login in with sso token 361 | await api.loginAsync('your_sso_token') 362 | 363 | # retrieving combat history 364 | hist = await api.Warzone.combatHistoryWithDateAsync(platforms.Battlenet, "Username#1234", 1657919309, 1657949309) # returns data of type dict 365 | 366 | # printing results to console 367 | print(hist) 368 | 369 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 370 | 371 | Additionally the methods ``breakdown()`` and ``breakdownWithDate()`` for sync environments and ``breakdownAsync()`` and 372 | ``breakdownWithDateAsync()`` for async environments, can be used to retrieve combat history without details, where only 373 | the platform played on, game title, UTC timestamp, type ID, match ID and map ID is returned for every match. These 374 | methods are available for all ``ColdWar``, ``ModernWarfare``, ``ModernWarfare2``, ``Vanguard``, ``Warzone`` and 375 | ``Warzone2`` classes. 376 | 377 | The ``breakdown()`` and `breakdownAsync()`` takes 2 input parameters which are ``platform`` and ``gamertag`` of type 378 | `cod_api.platforms`_ and string respectively. 379 | 380 | Here's an example for retrieving **Warzone** combat history breakdown of a player whose gamer tag is **Username#1234** 381 | on platform **Battlenet**: 382 | 383 | .. code-block:: python 384 | 385 | from cod_api import API, platforms 386 | 387 | # initiating the API class 388 | api = API() 389 | 390 | ## sync 391 | # login in with sso token 392 | api.login('your_sso_token') 393 | 394 | # retrieving combat history breakdown 395 | hist_b = api.Warzone.breakdown(platforms.Battlenet, "Username#1234") # returns data of type dict 396 | 397 | # printing results to console 398 | print(hist_b) 399 | 400 | ## async 401 | # in an async function 402 | async def example(): 403 | # login in with sso token 404 | await api.loginAsync('your_sso_token') 405 | 406 | # retrieving combat history breakdown 407 | hist_b = await api.Warzone.breakdownAsync(platforms.Battlenet, "Username#1234") # returns data of type dict 408 | 409 | # printing results to console 410 | print(hist_b) 411 | 412 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 413 | 414 | The ``breakdownWithDate()`` and ``breakdownWithDateAsync()`` takes 4 input parameters which are ``platform``, 415 | ``gamertag``, ``start`` and ``end`` of type `cod_api.platforms`_, string, int and int respectively. 416 | 417 | ``start`` and ``end`` parameters are utc timestamps in microseconds. 418 | 419 | Here's an example for retrieving **ModernWarfare** combat history breakdown of a player whose gamer tag is 420 | **Username#1234567** on platform **Activision** with in the timestamps **1657919309** (Friday, 15 July 2022 21:08:29) 421 | and **1657949309** (Saturday, 16 July 2022 05:28:29): 422 | 423 | .. code-block:: python 424 | 425 | from cod_api import API, platforms 426 | 427 | # initiating the API class 428 | api = API() 429 | 430 | ## sync 431 | # login in with sso token 432 | api.login('your_sso_token') 433 | 434 | # retrieving combat history breakdown 435 | hist_b = api.Warzone.breakdownWithDate(platforms.Activision, "Username#1234567", 1657919309, 1657949309) # returns data of type dict 436 | 437 | # printing results to console 438 | print(hist_b) 439 | 440 | ## async 441 | # in an async function 442 | async def example(): 443 | # login in with sso token 444 | await api.loginAsync('your_sso_token') 445 | 446 | # retrieving combat history breakdown 447 | hist_b = await api.Warzone.breakdownWithDateAsync(platforms.Activision, "Username#1234567", 1657919309, 1657949309) # returns data of type dict 448 | 449 | # printing results to console 450 | print(hist_b) 451 | 452 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 453 | 454 | Match Details 455 | ------------- 456 | 457 | To retrieve details of a specific match, the method ``matchInfo()`` for sync environments and ``matchInfoAsync()`` for 458 | async environments can be used. These methods are available for all ``ColdWar``, ``ModernWarfare``, ``ModernWarfare2``, 459 | ``Vanguard``, ``Warzone`` and ``Warzone2`` classes. Details returned by this method contains additional data than that 460 | of details returned by the **combat history** methods for a single match. 461 | 462 | The ``matchInfo()`` and ``matchInfoAsync()`` takes 2 input parameters which are ``platform`` and ``matchId`` of type 463 | `cod_api.platforms`_ and integer respectively. 464 | 465 | *Optionally the match ID can be retrieved during your gameplay where it will be visible on bottom left corner* 466 | 467 | Here's an example for retrieving **Warzone** match details of a match where its id is **9484583876389482453** 468 | on platform **Battlenet**: 469 | 470 | .. code-block:: python 471 | 472 | from cod_api import API, platforms 473 | 474 | # initiating the API class 475 | api = API() 476 | 477 | ## sync 478 | # login in with sso token 479 | api.login('your_sso_token') 480 | 481 | # retrieving match details 482 | details = api.Warzone.matchInfo(platforms.Battlenet, 9484583876389482453) # returns data of type dict 483 | 484 | # printing results to console 485 | print(details) 486 | 487 | ## async 488 | # in an async function 489 | async def example(): 490 | # login in with sso token 491 | await api.loginAsync('your_sso_token') 492 | 493 | # retrieving match details 494 | details = await api.Warzone.matchInfoAsync(platforms.Battlenet, 9484583876389482453) # returns data of type dict 495 | 496 | # printing results to console 497 | print(details) 498 | 499 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 500 | 501 | Season Loot 502 | ----------- 503 | 504 | Using the ``seasonLoot()`` for sync environments and ``seasonLootAsync()`` for async environments, player's obtained 505 | season loot can be retrieved for a specific game and this method is available for ``ColdWar``, ``ModernWarfare``, 506 | ``ModernWarfare2`` and ``Vanguard`` classes. 507 | 508 | The ``seasonLoot()`` and ``seasonLootAsync()`` takes 2 input parameters which are ``platform`` and ``matchId`` of type 509 | `cod_api.platforms`_ and integer respectively. 510 | 511 | Here's an example for retrieving **ColdWar** season loot obtained by a player whose gamer tag is **Username#1234** on 512 | platform **Battlenet**: 513 | 514 | .. code-block:: python 515 | 516 | from cod_api import API, platforms 517 | 518 | # initiating the API class 519 | api = API() 520 | 521 | ## sync 522 | # login in with sso token 523 | api.login('your_sso_token') 524 | 525 | # retrieving season loot 526 | loot = api.ColdWar.seasonLoot(platforms.Battlenet, "Username#1234") # returns data of type dict) 527 | 528 | # printing results to console 529 | print(loot) 530 | 531 | ## async 532 | # in an async function 533 | async def example(): 534 | # login in with sso token 535 | await api.loginAsync('your_sso_token') 536 | 537 | # retrieving season loot 538 | loot = await api.ColdWar.seasonLootAsync(platforms.Battlenet, "Username#1234") # returns data of type dict 539 | 540 | # printing results to console 541 | print(loot) 542 | 543 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 544 | 545 | Map List 546 | -------- 547 | 548 | Using the ``mapList()`` for sync environments and ``mapListAsync()`` for async environments, all the maps and its 549 | available modes can be retrieved for a specific game. These methods are available for ``ColdWar``, ``ModernWarfare``, 550 | ``ModernWarfare2`` and ``Vanguard`` classes. 551 | 552 | The ``mapList()`` and ``mapListAsync()`` takes 1 input parameters which is ``platform`` of type `cod_api.platforms`_. 553 | 554 | Here's an example for retrieving **Vanguard** map list and available modes respectively on platform PlayStation 555 | (**PSN**): 556 | 557 | .. code-block:: python 558 | 559 | from cod_api import API, platforms 560 | 561 | # initiating the API class 562 | api = API() 563 | 564 | ## sync 565 | # login in with sso token 566 | api.login('your_sso_token') 567 | 568 | # retrieving maps and respective modes available 569 | maps = api.Vanguard.mapList(platforms.PSN) # returns data of type dict 570 | 571 | # printing results to console 572 | print(maps) 573 | 574 | ## async 575 | # in an async function 576 | async def example(): 577 | # login in with sso token 578 | await api.loginAsync('your_sso_token') 579 | 580 | # retrieving season loot 581 | maps = await api.Vanguard.mapListAsync(platforms.PSN) # returns data of type dict 582 | 583 | # printing results to console 584 | print(maps) 585 | 586 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 587 | 588 | 589 | .. _cod_api.platforms: 590 | 591 | platforms 592 | --------- 593 | 594 | ``platforms`` is an enum class available in ``cod_api`` which is used to specify the platform in certain method calls. 595 | 596 | Available ``platforms`` are as follows: 597 | 598 | +----------------------+----------------------------------------+ 599 | |Platform | Remarks | 600 | +======================+========================================+ 601 | |platforms.All | All (no usage till further updates) | 602 | +----------------------+----------------------------------------+ 603 | |platforms.Activision | Activision | 604 | +----------------------+----------------------------------------+ 605 | |platforms.Battlenet | Battlenet | 606 | +----------------------+----------------------------------------+ 607 | |platforms.PSN | PlayStation | 608 | +----------------------+----------------------------------------+ 609 | |platforms.Steam | Steam (no usage till further updates) | 610 | +----------------------+----------------------------------------+ 611 | |platforms.Uno | Uno (activision unique id) | 612 | +----------------------+----------------------------------------+ 613 | |platforms.XBOX | Xbox | 614 | +----------------------+----------------------------------------+ 615 | 616 | ``platforms`` can be imported and used as follows: 617 | 618 | .. code-block:: python 619 | 620 | from cod_api import platforms 621 | 622 | platforms.All # All (no usage till further updates) 623 | 624 | platforms.Activision # Activision 625 | 626 | platforms.Battlenet # Battlenet 627 | 628 | platforms.PSN # PlayStation 629 | 630 | platforms.Steam # Steam (no usage till further updates) 631 | 632 | platforms.Uno # Uno (activision unique id) 633 | 634 | platforms.XBOX # Xbox 635 | 636 | User Info 637 | ---------- 638 | 639 | Using the ``info()`` method in sub class ``Me`` of ``API`` user information can be retrieved of the sso-token logged in 640 | with 641 | 642 | .. code-block:: python 643 | 644 | from cod_api import API 645 | 646 | # initiating the API class 647 | api = API() 648 | 649 | # login in with sso token 650 | api.login('your_sso_token') 651 | 652 | # retrieving user info 653 | userInfo = api.Me.info() # returns data of type dict 654 | 655 | # printing results to console 656 | print(userInfo) 657 | 658 | User Friend Feed 659 | ---------------- 660 | 661 | Using the methods, ``friendFeed()`` for sync environments and ``friendFeedAsync()`` for async environments, in sub class 662 | ``Me`` of ``API``, user's friend feed can be retrieved of the sso-token logged in with 663 | 664 | .. code-block:: python 665 | 666 | from cod_api import API 667 | 668 | # initiating the API class 669 | api = API() 670 | 671 | ## sync 672 | # login in with sso token 673 | api.login('your_sso_token') 674 | 675 | # retrieving user friend feed 676 | friendFeed = api.Me.friendFeed() # returns data of type dict 677 | 678 | # printing results to console 679 | print(friendFeed) 680 | 681 | ## async 682 | # in an async function 683 | async def example(): 684 | # login in with sso token 685 | await api.loginAsync('your_sso_token') 686 | 687 | # retrieving user friend feed 688 | friendFeed = await api.Me.friendFeedAsync() # returns data of type dict 689 | 690 | # printing results to console 691 | print(friendFeed) 692 | 693 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 694 | 695 | User Event Feed 696 | ---------------- 697 | 698 | Using the methods ``eventFeed()`` for sync environments and ``eventFeedAsync()`` for async environments, in sub class 699 | ``Me`` of ``API`` user's event feed can be retrieved of the sso-token logged in with 700 | 701 | .. code-block:: python 702 | 703 | from cod_api import API 704 | 705 | # initiating the API class 706 | api = API() 707 | 708 | ## sync 709 | # login in with sso token 710 | api.login('your_sso_token') 711 | 712 | # retrieving user event feed 713 | eventFeed = api.Me.eventFeed() # returns data of type dict 714 | 715 | # printing results to console 716 | print(eventFeed) 717 | 718 | ## async 719 | # in an async function 720 | async def example(): 721 | # login in with sso token 722 | await api.loginAsync('your_sso_token') 723 | 724 | # retrieving user event feed 725 | eventFeed = await api.Me.eventFeedAsync() # returns data of type dict 726 | 727 | # printing results to console 728 | print(eventFeed) 729 | 730 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 731 | 732 | User Identities 733 | ---------------- 734 | 735 | Using the methods ``loggedInIdentities()`` for sync environments and ``loggedInIdentitiesAsync()`` for async 736 | environments, in sub class ``Me`` of ``API`` user's identities can be retrieved of the sso-token logged in with 737 | 738 | .. code-block:: python 739 | 740 | from cod_api import API 741 | 742 | # initiating the API class 743 | api = API() 744 | 745 | ## sync 746 | # login in with sso token 747 | api.login('your_sso_token') 748 | 749 | # retrieving user identities 750 | identities = api.Me.loggedInIdentities() # returns data of type dict 751 | 752 | # printing results to console 753 | print(identities) 754 | 755 | ## async 756 | # in an async function 757 | async def example(): 758 | # login in with sso token 759 | await api.loginAsync('your_sso_token') 760 | 761 | # retrieving user identities 762 | identities = await api.Me.loggedInIdentitiesAsync() # returns data of type dict 763 | 764 | # printing results to console 765 | print(identities) 766 | 767 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 768 | 769 | User COD Points 770 | ---------------- 771 | 772 | Using the methods ``codPoints()`` for sync environments and ``codPointsAsync()`` for async environments, in sub class 773 | ``Me`` of ``API`` user's cod points can be retrieved of the sso-token logged in with 774 | 775 | .. code-block:: python 776 | 777 | from cod_api import API 778 | 779 | # initiating the API class 780 | api = API() 781 | 782 | ## sync 783 | # login in with sso token 784 | api.login('your_sso_token') 785 | 786 | # retrieving user cod points 787 | cp = api.Me.codPoints() # returns data of type dict 788 | 789 | # printing results to console 790 | print(cp) 791 | 792 | ## async 793 | # in an async function 794 | async def example(): 795 | # login in with sso token 796 | await api.loginAsync('your_sso_token') 797 | 798 | # retrieving user cod points 799 | cp = await api.Me.codPointsAsync() # returns data of type dict 800 | 801 | # printing results to console 802 | print(cp) 803 | 804 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 805 | 806 | User Accounts 807 | ---------------- 808 | 809 | Using the methods ``connectedAccounts()`` for sync environments and ``connectedAccountsAsync()`` for async environments, 810 | in sub class ``Me`` of ``API`` user's connected accounts can be retrieved of the sso-token logged in with 811 | 812 | .. code-block:: python 813 | 814 | from cod_api import API 815 | 816 | # initiating the API class 817 | api = API() 818 | 819 | ## sync 820 | # login in with sso token 821 | api.login('your_sso_token') 822 | 823 | # retrieving user connected accounts 824 | accounts = api.Me.connectedAccounts() # returns data of type dict 825 | 826 | # printing results to console 827 | print(accounts) 828 | 829 | ## async 830 | # in an async function 831 | async def example(): 832 | # login in with sso token 833 | await api.loginAsync('your_sso_token') 834 | 835 | # retrieving user connected accounts 836 | accounts = await api.Me.connectedAccountsAsync() # returns data of type dict 837 | 838 | # printing results to console 839 | print(accounts) 840 | 841 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 842 | 843 | User settings 844 | ---------------- 845 | 846 | Using the methods ``settings()`` for sync environments and ``settingsAsync()`` for async environments, in sub class 847 | ``Me`` of ``API`` user's settings can be retrieved of the sso-token logged in with 848 | 849 | .. code-block:: python 850 | 851 | from cod_api import API 852 | 853 | # initiating the API class 854 | api = API() 855 | 856 | ## sync 857 | # login in with sso token 858 | api.login('your_sso_token') 859 | 860 | # retrieving user settings 861 | settings = api.Me.settings() # returns data of type dict 862 | 863 | # printing results to console 864 | print(settings) 865 | 866 | ## async 867 | # in an async function 868 | async def example(): 869 | # login in with sso token 870 | await api.loginAsync('your_sso_token') 871 | 872 | # retrieving user settings 873 | settings = await api.Me.settingsAsync() # returns data of type dict 874 | 875 | # printing results to console 876 | print(settings) 877 | 878 | # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT 879 | 880 | ------------------------------------------------------------------------------------------------------------------------------- 881 | 882 | Donate 883 | ====== 884 | 885 | * `Donate Todo Lodo`_ 886 | * `Donate Engineer152`_ 887 | * `Donate Werseter`_ 888 | 889 | .. _Donate Todo Lodo: https://www.buymeacoffee.com/todolodo2089 890 | .. _Donate Engineer152: https://www.paypal.com/paypalme/engineer15 891 | .. _Donate Werseter: https://paypal.me/werseter 892 | -------------------------------------------------------------------------------- /cod_api/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "2.0.1" 2 | 3 | # Imports 4 | import asyncio 5 | import enum 6 | import json 7 | import uuid 8 | from abc import abstractmethod 9 | from datetime import datetime 10 | from urllib.parse import quote 11 | 12 | import aiohttp 13 | import requests 14 | from aiohttp import ClientResponseError 15 | 16 | 17 | # Enums 18 | 19 | class platforms(enum.Enum): 20 | All = 'all' 21 | Activision = 'acti' 22 | Battlenet = 'battle' 23 | PSN = 'psn' 24 | Steam = 'steam' 25 | Uno = 'uno' 26 | XBOX = 'xbl' 27 | 28 | 29 | class games(enum.Enum): 30 | ColdWar = 'cw' 31 | ModernWarfare = 'mw' 32 | ModernWarfare2 = 'mw2' 33 | Vanguard = 'vg' 34 | Warzone = 'wz' 35 | Warzone2 = 'wz2' 36 | 37 | 38 | class friendActions(enum.Enum): 39 | Invite = "invite" 40 | Uninvite = "uninvite" 41 | Remove = "remove" 42 | Block = "block" 43 | Unblock = "unblock" 44 | 45 | 46 | class API: 47 | """ 48 | Call Of Duty API Wrapper 49 | 50 | Developed by Todo Lodo & Engineer152 51 | 52 | Contributors 53 | - Werseter 54 | 55 | Source Code: https://github.com/TodoLodo/cod-python-api 56 | """ 57 | def __init__(self): 58 | # sub classes 59 | self.Warzone = self.__WZ() 60 | self.ModernWarfare = self.__MW() 61 | self.Warzone2 = self.__WZ2() 62 | self.ModernWarfare2 = self.__MW2() 63 | self.ColdWar = self.__CW() 64 | self.Vanguard = self.__VG() 65 | self.Shop = self.__SHOP() 66 | self.Me = self.__USER() 67 | self.Misc = self.__ALT() 68 | 69 | async def loginAsync(self, sso_token: str) -> None: 70 | await API._Common.loginAsync(sso_token) 71 | 72 | # Login 73 | def login(self, ssoToken: str): 74 | API._Common.login(ssoToken) 75 | 76 | class _Common: 77 | requestHeaders = { 78 | "content-type": "application/json", 79 | "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " 80 | "AppleWebKit/537.36 (KHTML, like Gecko) " 81 | "Chrome/74.0.3729.169 " 82 | "Safari/537.36", 83 | "Accept": "application/json", 84 | "Connection": "Keep-Alive" 85 | } 86 | cookies = {"new_SiteId": "cod", "ACT_SSO_LOCALE": "en_US", "country": "US", 87 | "ACT_SSO_COOKIE_EXPIRY": "1645556143194"} 88 | cachedMappings = None 89 | 90 | fakeXSRF = str(uuid.uuid4()) 91 | baseUrl: str = "https://my.callofduty.com/api/papi-client" 92 | loggedIn: bool = False 93 | 94 | # endPoints 95 | 96 | # game platform lookupType gamertag type 97 | fullDataUrl = "/stats/cod/v1/title/%s/platform/%s/%s/%s/profile/type/%s" 98 | # game platform lookupType gamertag type start end [?limit=n or ''] 99 | combatHistoryUrl = "/crm/cod/v2/title/%s/platform/%s/%s/%s/matches/%s/start/%d/end/%d/details" 100 | # game platform lookupType gamertag type start end 101 | breakdownUrl = "/crm/cod/v2/title/%s/platform/%s/%s/%s/matches/%s/start/%d/end/%d" 102 | # game platform lookupType gamertag 103 | seasonLootUrl = "/loot/title/%s/platform/%s/%s/%s/status/en" 104 | # game platform 105 | mapListUrl = "/ce/v1/title/%s/platform/%s/gameType/mp/communityMapData/availability" 106 | # game platform type matchId 107 | matchInfoUrl = "/crm/cod/v2/title/%s/platform/%s/fullMatch/%s/%d/en" 108 | 109 | @staticmethod 110 | async def loginAsync(sso_token: str) -> None: 111 | API._Common.cookies["ACT_SSO_COOKIE"] = sso_token 112 | API._Common.baseSsoToken = sso_token 113 | r = await API._Common.__Request(f"{API._Common.baseUrl}/crm/cod/v2/identities/{sso_token}") 114 | if r['status'] == 'success': 115 | API._Common.loggedIn = True 116 | else: 117 | raise InvalidToken(sso_token) 118 | 119 | @staticmethod 120 | def login(sso_token: str) -> None: 121 | API._Common.cookies["ACT_SSO_COOKIE"] = sso_token 122 | API._Common.baseSsoToken = sso_token 123 | 124 | r = requests.get(f"{API._Common.baseUrl}/crm/cod/v2/identities/{sso_token}", 125 | headers=API._Common.requestHeaders, cookies=API._Common.cookies) 126 | 127 | if r.json()['status'] == 'success': 128 | API._Common.loggedIn = True 129 | API._Common.cookies.update(r.cookies) 130 | else: 131 | raise InvalidToken(sso_token) 132 | 133 | @staticmethod 134 | def sso_token() -> str: 135 | return API._Common.cookies["ACT_SSO_COOKIE"] 136 | 137 | # Requests 138 | 139 | @staticmethod 140 | async def __Request(url): 141 | async with aiohttp.client.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=True), 142 | timeout=aiohttp.ClientTimeout(total=30)) as session: 143 | try: 144 | async with session.get(url, cookies=API._Common.cookies, 145 | headers=API._Common.requestHeaders) as resp: 146 | try: 147 | resp.raise_for_status() 148 | except ClientResponseError as err: 149 | return {'status': 'error', 'data': {'type': type(err), 'message': err.message}} 150 | else: 151 | API._Common.cookies.update({c.key: c.value for c in session.cookie_jar}) 152 | return await resp.json() 153 | except asyncio.TimeoutError as err: 154 | return {'status': 'error', 'data': {'type': type(err), 'message': str(err)}} 155 | 156 | async def __sendRequest(self, url: str): 157 | if self.loggedIn: 158 | response = await API._Common.__Request(f"{self.baseUrl}{url}") 159 | if response['status'] == 'success': 160 | response['data'] = await self.__perform_mapping(response['data']) 161 | return response 162 | else: 163 | raise NotLoggedIn 164 | 165 | # client name url formatter 166 | def __cleanClientName(self, gamertag): 167 | return quote(gamertag.encode("utf-8")) 168 | 169 | # helper 170 | def __helper(self, platform, gamertag): 171 | lookUpType = "gamer" 172 | if platform == platforms.Uno: 173 | lookUpType = "id" 174 | if platform == platforms.Activision: 175 | platform = platforms.Uno 176 | if platform not in [platforms.Activision, platforms.Battlenet, platforms.Uno, platforms.All, platforms.PSN, 177 | platforms.XBOX]: 178 | raise InvalidPlatform(platform) 179 | else: 180 | gamertag = self.__cleanClientName(gamertag) 181 | return lookUpType, gamertag, platform 182 | 183 | async def __get_mappings(self): 184 | if API._Common.cachedMappings is None: 185 | API._Common.cachedMappings = ( 186 | await API._Common.__Request('https://engineer152.github.io/wz-data/weapon-ids.json'), 187 | await API._Common.__Request('https://engineer152.github.io/wz-data/game-modes.json'), 188 | await API._Common.__Request('https://engineer152.github.io/wz-data/perks.json')) 189 | return API._Common.cachedMappings 190 | 191 | # mapping 192 | async def __perform_mapping(self, data): 193 | guns, modes, perks = await self.__get_mappings() 194 | if not isinstance(data, list) or 'matches' not in data: 195 | return data 196 | try: 197 | for match in data['matches']: 198 | # time stamps 199 | try: 200 | match['utcStartDateTime'] = datetime.fromtimestamp( 201 | match['utcStartSeconds']).strftime("%A, %B %d, %Y, %I:%M:%S") 202 | match['utcEndDateTime'] = datetime.fromtimestamp( 203 | match['utcEndSeconds']).strftime("%A, %B %d, %Y, %I:%M:%S") 204 | except KeyError: 205 | pass 206 | 207 | # loadouts list 208 | for loadout in match['player']['loadouts']: 209 | # weapons 210 | if loadout['primaryWeapon']['label'] is None: 211 | try: 212 | loadout['primaryWeapon']['label'] = guns[loadout['primaryWeapon']['name']] 213 | except KeyError: 214 | pass 215 | if loadout['secondaryWeapon']['label'] is None: 216 | try: 217 | loadout['secondaryWeapon']['label'] = guns[loadout['secondaryWeapon']['name']] 218 | except KeyError: 219 | pass 220 | 221 | # perks list 222 | for perk in loadout['perks']: 223 | if perk['label'] is None: 224 | try: 225 | perk['label'] = perks[perk['name']] 226 | except KeyError: 227 | pass 228 | 229 | # extra perks list 230 | for perk in loadout['extraPerks']: 231 | if perk['label'] is None: 232 | try: 233 | perk['label'] = perks[perk['name']] 234 | except KeyError: 235 | pass 236 | 237 | # loadout list 238 | for loadout in match['player']['loadout']: 239 | if loadout['primaryWeapon']['label'] is None: 240 | try: 241 | loadout['primaryWeapon']['label'] = guns[loadout['primaryWeapon']['name']] 242 | except KeyError: 243 | pass 244 | if loadout['secondaryWeapon']['label'] is None: 245 | try: 246 | loadout['secondaryWeapon']['label'] = guns[loadout['secondaryWeapon']['name']] 247 | except KeyError: 248 | pass 249 | 250 | # perks list 251 | for perk in loadout['perks']: 252 | if perk['label'] is None: 253 | try: 254 | perk['label'] = perks[perk['name']] 255 | except KeyError: 256 | pass 257 | 258 | # extra perks list 259 | for perk in loadout['extraPerks']: 260 | if perk['label'] is None: 261 | try: 262 | perk['label'] = perks[perk['name']] 263 | except KeyError: 264 | pass 265 | except KeyError: 266 | pass 267 | 268 | # return mapped or unmapped data 269 | return data 270 | 271 | # API Requests 272 | async def _fullDataReq(self, game, platform, gamertag, type): 273 | lookUpType, gamertag, platform = self.__helper(platform, gamertag) 274 | return await self.__sendRequest(self.fullDataUrl % (game, platform.value, lookUpType, gamertag, type)) 275 | 276 | async def _combatHistoryReq(self, game, platform, gamertag, type, start, end): 277 | lookUpType, gamertag, platform = self.__helper(platform, gamertag) 278 | return await self.__sendRequest( 279 | self.combatHistoryUrl % (game, platform.value, lookUpType, gamertag, type, start, end)) 280 | 281 | async def _breakdownReq(self, game, platform, gamertag, type, start, end): 282 | lookUpType, gamertag, platform = self.__helper(platform, gamertag) 283 | return await self.__sendRequest( 284 | self.breakdownUrl % (game, platform.value, lookUpType, gamertag, type, start, end)) 285 | 286 | async def _seasonLootReq(self, game, platform, gamertag): 287 | lookUpType, gamertag, platform = self.__helper(platform, gamertag) 288 | return await self.__sendRequest(self.seasonLootUrl % (game, platform.value, lookUpType, gamertag)) 289 | 290 | async def _mapListReq(self, game, platform): 291 | return await self.__sendRequest(self.mapListUrl % (game, platform.value)) 292 | 293 | async def _matchInfoReq(self, game, platform, type, matchId): 294 | return await self.__sendRequest(self.matchInfoUrl % (game, platform.value, type, matchId)) 295 | 296 | class __GameDataCommons(_Common): 297 | """ 298 | Methods 299 | ======= 300 | Sync 301 | ---- 302 | fullData(platform:platforms, gamertag:str) 303 | returns player's game data of type dict 304 | 305 | combatHistory(platform:platforms, gamertag:str) 306 | returns player's combat history of type dict 307 | 308 | combatHistoryWithDate(platform:platforms, gamertag:str, start:int, end:int) 309 | returns player's combat history within the specified timeline of type dict 310 | 311 | breakdown(platform:platforms, gamertag:str) 312 | returns player's combat history breakdown of type dict 313 | 314 | breakdownWithDate(platform:platforms, gamertag:str, start:int, end:int) 315 | returns player's combat history breakdown within the specified timeline of type dict 316 | 317 | seasonLoot(platform:platforms, gamertag:str) 318 | returns player's season loot 319 | 320 | mapList(platform:platforms) 321 | returns available maps and available modes for each 322 | 323 | matchInfo(platform:platforms, matchId:int) 324 | returns details match details of type dict 325 | 326 | Async 327 | ---- 328 | fullDataAsync(platform:platforms, gamertag:str) 329 | returns player's game data of type dict 330 | 331 | combatHistoryAsync(platform:platforms, gamertag:str) 332 | returns player's combat history of type dict 333 | 334 | combatHistoryWithDateAsync(platform:platforms, gamertag:str, start:int, end:int) 335 | returns player's combat history within the specified timeline of type dict 336 | 337 | breakdownAsync(platform:platforms, gamertag:str) 338 | returns player's combat history breakdown of type dict 339 | 340 | breakdownWithDateAsync(platform:platforms, gamertag:str, start:int, end:int) 341 | returns player's combat history breakdown within the specified timeline of type dict 342 | 343 | seasonLootAsync(platform:platforms, gamertag:str) 344 | returns player's season loot 345 | 346 | mapListAsync(platform:platforms) 347 | returns available maps and available modes for each 348 | 349 | matchInfoAsync(platform:platforms, matchId:int) 350 | returns details match details of type dict 351 | """ 352 | 353 | def __init_subclass__(cls, **kwargs): 354 | cls.__doc__ = cls.__doc__ + super(cls, cls).__doc__ 355 | 356 | @property 357 | @abstractmethod 358 | def _game(self) -> str: 359 | raise NotImplementedError 360 | 361 | @property 362 | @abstractmethod 363 | def _type(self) -> str: 364 | raise NotImplementedError 365 | 366 | async def fullDataAsync(self, platform: platforms, gamertag: str): 367 | data = await self._fullDataReq(self._game, platform, gamertag, self._type) 368 | return data 369 | 370 | def fullData(self, platform: platforms, gamertag: str): 371 | return asyncio.run(self.fullDataAsync(platform, gamertag)) 372 | 373 | async def combatHistoryAsync(self, platform: platforms, gamertag: str): 374 | data = await self._combatHistoryReq(self._game, platform, gamertag, self._type, 0, 0) 375 | return data 376 | 377 | def combatHistory(self, platform: platforms, gamertag: str): 378 | return asyncio.run(self.combatHistoryAsync(platform, gamertag)) 379 | 380 | async def combatHistoryWithDateAsync(self, platform, gamertag: str, start: int, end: int): 381 | data = await self._combatHistoryReq(self._game, platform, gamertag, self._type, start, end) 382 | return data 383 | 384 | def combatHistoryWithDate(self, platform, gamertag: str, start: int, end: int): 385 | return asyncio.run(self.combatHistoryWithDateAsync(platform, gamertag, start, end)) 386 | 387 | async def breakdownAsync(self, platform, gamertag: str): 388 | data = await self._breakdownReq(self._game, platform, gamertag, self._type, 0, 0) 389 | return data 390 | 391 | def breakdown(self, platform, gamertag: str): 392 | return asyncio.run(self.breakdownAsync(platform, gamertag)) 393 | 394 | async def breakdownWithDateAsync(self, platform, gamertag: str, start: int, end: int): 395 | data = await self._breakdownReq(self._game, platform, gamertag, self._type, start, end) 396 | return data 397 | 398 | def breakdownWithDate(self, platform, gamertag: str, start: int, end: int): 399 | return asyncio.run(self.breakdownWithDateAsync(platform, gamertag, start, end)) 400 | 401 | async def matchInfoAsync(self, platform, matchId: int): 402 | data = await self._matchInfoReq(self._game, platform, self._type, matchId) 403 | return data 404 | 405 | def matchInfo(self, platform, matchId: int): 406 | return asyncio.run(self.matchInfoAsync(platform, matchId)) 407 | 408 | async def seasonLootAsync(self, platform, gamertag): 409 | data = await self._seasonLootReq(self._game, platform, gamertag) 410 | return data 411 | 412 | def seasonLoot(self, platform, gamertag): 413 | return asyncio.run(self.seasonLootAsync(platform, gamertag)) 414 | 415 | async def mapListAsync(self, platform): 416 | data = await self._mapListReq(self._game, platform) 417 | return data 418 | 419 | def mapList(self, platform): 420 | return asyncio.run(self.mapListAsync(platform)) 421 | # WZ 422 | 423 | class __WZ(__GameDataCommons): 424 | """ 425 | Warzone class: A class to get players warzone stats, warzone combat history and specific warzone match details 426 | classCategory: game 427 | gameId/gameTitle: mw or wz 428 | gameType: wz 429 | 430 | """ 431 | 432 | @property 433 | def _game(self) -> str: 434 | return "mw" 435 | 436 | @property 437 | def _type(self) -> str: 438 | return "wz" 439 | 440 | async def seasonLootAsync(self, platform, gamertag): 441 | raise InvalidEndpoint 442 | 443 | async def mapListAsync(self, platform): 444 | raise InvalidEndpoint 445 | 446 | # WZ2 447 | 448 | class __WZ2(__GameDataCommons): 449 | """ 450 | Warzone 2 class: A class to get players warzone 2 stats, warzone 2 combat history and specific warzone 2 match details 451 | classCategory: game 452 | gameId/gameTitle: mw or wz 453 | gameType: wz2 454 | 455 | """ 456 | 457 | @property 458 | def _game(self) -> str: 459 | return "mw2" 460 | 461 | @property 462 | def _type(self) -> str: 463 | return "wz2" 464 | 465 | async def seasonLootAsync(self, platform, gamertag): 466 | raise InvalidEndpoint 467 | 468 | async def mapListAsync(self, platform): 469 | raise InvalidEndpoint 470 | 471 | # MW 472 | 473 | class __MW(__GameDataCommons): 474 | """ 475 | ModernWarfare class: A class to get players modernwarfare stats, modernwarfare combat history, a player's modernwarfare season loot, modernwarfare map list and specific modernwarfare match details 476 | classCategory: game 477 | gameId/gameTitle: mw 478 | gameType: mp 479 | 480 | """ 481 | 482 | @property 483 | def _game(self) -> str: 484 | return "mw" 485 | 486 | @property 487 | def _type(self) -> str: 488 | return "mp" 489 | 490 | # CW 491 | 492 | class __CW(__GameDataCommons): 493 | """ 494 | ColdWar class: A class to get players coldwar stats, coldwar combat history, a player's coldwar season loot, coldwar map list and specific coldwar match details 495 | classCategory: game 496 | gameId/gameTitle: cw 497 | gameType: mp 498 | 499 | """ 500 | @property 501 | def _game(self) -> str: 502 | return "cw" 503 | 504 | @property 505 | def _type(self) -> str: 506 | return "mp" 507 | 508 | # VG 509 | 510 | class __VG(__GameDataCommons): 511 | """ 512 | Vanguard class: A class to get players vanguard stats, vanguard combat history, a player's vanguard season loot, vanguard map list and specific vanguard match details 513 | classCategory: game 514 | gameId/gameTitle: vg 515 | gameType: pm 516 | 517 | """ 518 | 519 | @property 520 | def _game(self) -> str: 521 | return "vg" 522 | 523 | @property 524 | def _type(self) -> str: 525 | return "mp" 526 | 527 | # MW2 528 | 529 | class __MW2(__GameDataCommons): 530 | """ 531 | ModernWarfare 2 class: A class to get players modernwarfare 2 stats, modernwarfare 2 combat history, a player's modernwarfare 2 season loot, modernwarfare 2 map list and specific modernwarfare 2 match details 532 | classCategory: game 533 | gameId/gameTitle: mw 534 | gameType: mp 535 | 536 | """ 537 | 538 | @property 539 | def _game(self) -> str: 540 | return "mw2" 541 | 542 | @property 543 | def _type(self) -> str: 544 | return "mp" 545 | 546 | # USER 547 | class __USER(_Common): 548 | def info(self): 549 | if self.loggedIn: 550 | rawData = requests.get(f"https://profile.callofduty.com/cod/userInfo/{self.sso_token()}", 551 | headers=API._Common.requestHeaders) 552 | rawData = json.loads(rawData.text.replace( 553 | 'userInfo(', '').replace(');', '')) 554 | 555 | data = {'userName': rawData['userInfo']['userName'], 'identities': []} 556 | for i in rawData['identities']: 557 | data['identities'].append({ 558 | 'platform': i['provider'], 559 | 'gamertag': i['username'], 560 | 'accountID': i['accountID'] 561 | }) 562 | return data 563 | else: 564 | raise NotLoggedIn 565 | 566 | def __priv(self): 567 | d = self.info() 568 | return d['identities'][0]['platform'], quote(d['identities'][0]['gamertag'].encode("utf-8")) 569 | 570 | async def friendFeedAsync(self): 571 | p, g = self.__priv() 572 | data = await self._Common__sendRequest( 573 | f"/userfeed/v1/friendFeed/platform/{p}/gamer/{g}/friendFeedEvents/en") 574 | return data 575 | 576 | def friendFeed(self): 577 | return asyncio.run(self.friendFeedAsync()) 578 | 579 | async def eventFeedAsync(self): 580 | data = await self._Common__sendRequest(f"/userfeed/v1/friendFeed/rendered/en/{self.sso_token()}") 581 | return data 582 | 583 | def eventFeed(self): 584 | return asyncio.run(self.eventFeedAsync()) 585 | 586 | async def loggedInIdentitiesAsync(self): 587 | data = await self._Common__sendRequest(f"/crm/cod/v2/identities/{self.sso_token()}") 588 | return data 589 | 590 | def loggedInIdentities(self): 591 | return asyncio.run(self.loggedInIdentitiesAsync()) 592 | 593 | async def codPointsAsync(self): 594 | p, g = self.__priv() 595 | data = await self._Common__sendRequest(f"/inventory/v1/title/mw/platform/{p}/gamer/{g}/currency") 596 | return data 597 | 598 | def codPoints(self): 599 | return asyncio.run(self.codPointsAsync()) 600 | 601 | async def connectedAccountsAsync(self): 602 | p, g = self.__priv() 603 | data = await self._Common__sendRequest(f"/crm/cod/v2/accounts/platform/{p}/gamer/{g}") 604 | return data 605 | 606 | def connectedAccounts(self): 607 | return asyncio.run(self.connectedAccountsAsync()) 608 | 609 | async def settingsAsync(self): 610 | p, g = self.__priv() 611 | data = await self._Common__sendRequest(f"/preferences/v1/platform/{p}/gamer/{g}/list") 612 | return data 613 | 614 | def settings(self): 615 | return asyncio.run(self.settingsAsync()) 616 | 617 | # SHOP 618 | class __SHOP(_Common): 619 | """ 620 | Shop class: A class to get bundle details and battle pass loot 621 | classCategory: other 622 | 623 | Methods 624 | ======= 625 | Sync 626 | ---- 627 | purchasableItems(game: games) 628 | returns purchasable items for a specific gameId/gameTitle 629 | 630 | bundleInformation(game: games, bundleId: int) 631 | returns bundle details for the specific gameId/gameTitle and bundleId 632 | 633 | battlePassLoot(game: games, platform: platforms, season: int) 634 | returns battle pass loot for specific game and season on given platform 635 | 636 | Async 637 | ---- 638 | purchasableItemsAsync(game: games) 639 | returns purchasable items for a specific gameId/gameTitle 640 | 641 | bundleInformationAsync(game: games, bundleId: int) 642 | returns bundle details for the specific gameId/gameTitle and bundleId 643 | 644 | battlePassLootAsync(game: games, platform: platforms, season: int) 645 | returns battle pass loot for specific game and season on given platform 646 | """ 647 | 648 | async def purchasableItemsAsync(self, game: games): 649 | data = await self._Common__sendRequest(f"/inventory/v1/title/{game.value}/platform/uno/purchasable/public/en") 650 | return data 651 | 652 | def purchasableItems(self, game: games): 653 | return asyncio.run(self.purchasableItemsAsync(game)) 654 | 655 | async def bundleInformationAsync(self, game: games, bundleId: int): 656 | data = await self._Common__sendRequest(f"/inventory/v1/title/{game.value}/bundle/{bundleId}/en") 657 | return data 658 | 659 | def bundleInformation(self, game: games, bundleId: int): 660 | return asyncio.run(self.bundleInformationAsync(game, bundleId)) 661 | 662 | async def battlePassLootAsync(self, game: games, platform: platforms, season: int): 663 | data = await self._Common__sendRequest( 664 | f"/loot/title/{game.value}/platform/{platform.value}/list/loot_season_{season}/en") 665 | return data 666 | 667 | def battlePassLoot(self, game: games, platform: platforms, season: int): 668 | return asyncio.run(self.battlePassLootAsync(game, platform, season)) 669 | 670 | # ALT 671 | class __ALT(_Common): 672 | 673 | async def searchAsync(self, platform, gamertag: str): 674 | lookUpType, gamertag, platform = self._Common__helper(platform, gamertag) 675 | data = await self._Common__sendRequest(f"/crm/cod/v2/platform/{platform.value}/username/{gamertag}/search") 676 | return data 677 | 678 | def search(self, platform, gamertag: str): 679 | return asyncio.run(self.searchAsync(platform, gamertag)) 680 | 681 | 682 | # Exceptions 683 | 684 | class NotLoggedIn(Exception): 685 | def __str__(self): 686 | return "Not logged in!" 687 | 688 | 689 | class InvalidToken(Exception): 690 | def __init__(self, token): 691 | self.token = token 692 | 693 | def __str__(self): 694 | return f"Token is invalid, token: {self.token}" 695 | 696 | 697 | class InvalidPlatform(Exception): 698 | def __init__(self, platform: platforms): 699 | self.message: str 700 | if platform == platforms.Steam: 701 | self.message = "Steam cannot be used till further updates." 702 | else: 703 | self.message = "Invalid platform, use platform class!" 704 | 705 | 706 | super().__init__(self.message) 707 | 708 | def __str__(self): 709 | return self.message 710 | 711 | 712 | class InvalidEndpoint(Exception): 713 | def __str__(self): 714 | return "This endpoint is not available for selected title" 715 | 716 | 717 | class StatusError(Exception): 718 | def __str__(self): 719 | return "Status Error, Check if your sso token is valid or try again later." 720 | -------------------------------------------------------------------------------- /reuirements_dev.txt: -------------------------------------------------------------------------------- 1 | asyncio 2 | datetime 3 | enum34 4 | requests 5 | twine 6 | urllib3 7 | uuid 8 | sphinx-tabs -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | version = attr: cod_api.__version__ 3 | description-file = README.rst 4 | url = https://codapi.dev/ 5 | project_urls = 6 | Source Code = https://github.com/TodoLodo2089/cod-python-api 7 | Issue Tracker = https://github.com/TodoLodo2089/cod-python-api/issues 8 | license = GPL-3.0 9 | author = Todo Lodo 10 | author_email = me@todolodo.xyz 11 | maintainer = Engineer15 12 | maintainer_email = engineergamer15@gmail.com 13 | description = Call Of Duty API. 14 | long_description = file: README.rst 15 | long_description_content_type = text/x-rst 16 | classifiers = 17 | Intended Audience :: Developers 18 | Operating System :: OS Independent 19 | Programming Language :: Python -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | requirements = ["asyncio", "aiohttp", "datetime", "requests", "uuid", "urllib3", "enum34"] 4 | 5 | setup( 6 | name="cod_api", 7 | packages=['cod_api'], 8 | install_requires=requirements 9 | ) 10 | --------------------------------------------------------------------------------