Skip to content

Commit

Permalink
Feat/add new endpoints (#30)
Browse files Browse the repository at this point in the history
* Add invalid token handling

* Add new endpoints and add deprecation warnings

* Bump version to 2.1
  • Loading branch information
tonybenoy authored Jul 8, 2023
1 parent 77d831a commit 8f3b6c5
Show file tree
Hide file tree
Showing 12 changed files with 1,132 additions and 560 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: black

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
black:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: black formatting
run: |
black cocapi
30 changes: 30 additions & 0 deletions .github/workflows/isort.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: isort

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
isort:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install isort
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Sort imports
run: |
isort cocapi
6 changes: 3 additions & 3 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ on:
branches: [ master ]

jobs:
build:
mypy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
39 changes: 35 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand Down Expand Up @@ -50,6 +49,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -72,6 +72,7 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -82,7 +83,9 @@ profile_default/
ipython_config.py

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand All @@ -91,7 +94,22 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
Expand Down Expand Up @@ -127,5 +145,18 @@ dmypy.json

# Pyre type checker
.pyre/
# vscode

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.vscode/
.ruff_cache/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ repos:
- "--max-line-length=88"

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</a>
</p>

# ClashOfClansAPI
# ClashOfClansAPI

Python Wrapper for SuperCells Clash Of Clans API

Expand All @@ -27,13 +27,13 @@ Get Token from https://developer.clashofclans.com/

### Initialize

Required to set up the class
Required to set up the class. Versions post 6.1.0 also support getting the status code of the API call. This is useful for debugging. To use it pass `status_code=True` to the `CocApi`.

```python
from cocapi import CocApi

token = 'YOUR_API_TOKEN'
timeout=1 #requests timeout
timeout=60 #requests timeout

api=CocApi(token,timeout)
```
Expand Down Expand Up @@ -121,7 +121,7 @@ api.clan_war_log(tag)
```
<details>
<summary>Click to view output</summary>

```text
{items:
[
Expand Down Expand Up @@ -200,7 +200,7 @@ api.clan_war_log(tag)
"endTime": "string",
"result": "string"
}
],
],
"paging": {'cursors': {}}
}
```
Expand Down Expand Up @@ -550,7 +550,7 @@ Top 200 clans in a given location
"previousRank": 0,
"badgeUrls": {}
}
],
],
"paging": {'cursors': {}}
}
```
Expand Down Expand Up @@ -587,7 +587,7 @@ Top 200 players in a given location
"previousRank": 0,
"trophies": 0
}
],
],
"paging": {'cursors': {}}
}
```
Expand All @@ -609,7 +609,7 @@ Top 200 versus clans in a given location
"clanPoints": 0,
"clanVersusPoints": 0
}
],
],
"paging": {'cursors': {}}
}
```
Expand Down Expand Up @@ -641,7 +641,7 @@ Top 200 versus players in a given location
"previousRank": 0,
"versusTrophies": 0
}
],
],
"paging": {'cursors': {}}
}
```
Expand All @@ -667,7 +667,7 @@ api.league()
"id": 0,
"iconUrls": {}
}
],
],
"paging": {'cursors': {}}
}
```
Expand Down Expand Up @@ -705,7 +705,7 @@ Information is available only for Legend League
{
"id": "string"
}
],
],
"paging": {'cursors': {}}
}
```
Expand Down Expand Up @@ -743,7 +743,7 @@ Information is available only for Legend League
"previousRank": 0,
"trophies": 0
}
],
],
"paging": {'cursors': {}}
}
```
Expand All @@ -769,7 +769,7 @@ api.clan_leaguegroup(tag)
"id": 0,
"iconUrls": {}
}
],
],
"paging": {'cursors': {}}
}
```
Expand All @@ -791,7 +791,7 @@ api.labels_players()
"id": 0,
"iconUrls": {}
}
],
],
"paging": {'cursors': {}}
}
```
Expand Down
Loading

0 comments on commit 8f3b6c5

Please sign in to comment.