Name | coc.py JSON |
Version |
3.6.0
JSON |
| download |
home_page | None |
Summary | A python wrapper for the Clash of Clans API |
upload_time | 2024-05-17 16:52:39 |
maintainer | majordoobie, MagicTheDev, Kuchenmampfer, lukasthaler, doluk |
docs_url | None |
author | mathsman5133 |
requires_python | >=3.7.3 |
license | MIT |
keywords |
coc
clash of clans
coc.py
clash api
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
coc.py
======
.. image:: https://discordapp.com/api/guilds/566451504332931073/embed.png
:target: https://discord.gg/Eaja7gJ
:alt: Discord Server Invite
.. image:: https://img.shields.io/pypi/v/coc.py.svg
:target: https://pypi.python.org/pypi/coc.py
:alt: PyPI version info
.. image:: https://img.shields.io/pypi/pyversions/discord.py.svg
:target: https://pypi.python.org/pypi/coc.py
:alt: PyPI supported Python versions
Easy to use asynchronous Clash of Clans API wrapper in Python.
Key Features
-------------
- Asynchronous code
- Entire coverage of the official Clash of Clans API
- Email/password login removes the stress of managing tokens
- Optimised for speed, memory and performance
Getting Started
================
Installing
-----------
**Python 3.7 or higher is required**
.. code:: sh
# Linux/macOS
python3 -m pip install -U coc.py
# Windows
py -3 -m pip install -U coc.py
# to install the development version:
python3 -m pip install -U git+https://github.com/mathsman5133/coc.py
Quick Example
--------------
This is the basic usage of the library.
This example will get a player with a certain tag, and search for 5 clans with a name.
.. code:: py
import asyncio
import coc
async def main():
async with coc.Client() as coc_client:
try:
await coc_client.login("email", "password")
except coc.InvalidCredentials as error:
exit(error)
player = await coc_client.get_player("tag")
print(f"{player.name} has {player.trophies} trophies!")
clans = await coc_client.search_clans(name="best clan ever", limit=5)
for clan in clans:
print(f"{clan.name} ({clan.tag}) has {clan.member_count} members")
try:
war = await coc_client.get_current_war("#clantag")
print(f"{war.clan_tag} is currently in {war.state} state.")
except coc.privatewarlog:
print("uh oh, they have a private war log!")
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
pass
Basic Events Example
---------------------
This script will run forever, printing to the terminal
whenever someone joins the clan or a member of the clan donates troops.
.. code:: py
import asyncio
import logging
import coc
@coc.ClanEvents.member_join()
async def foo(player, clan):
print(f"{player.name} ({player.tag}) just joined {clan.name} ({clan.tag})")
@coc.ClanEvents.member_donations()
async def bar(old_member, member):
troops_donated = member.donations - old_member.donations
print(f"{member.name} just donated {troops_donated} troops!")
async def main():
coc_client = coc.EVentsClient()
try:
await coc.login("email", "password")
except coc.InvalidCredentials as error:
exit(error)
# Register all the clans you want to monitor
list_of_clan_tags = ["tag1", "tag2", "tag3"]
coc_client.add_clan_updates(*list_of_clan_tags)
# Register the callbacks for each of the events you are monitoring
coc_client.add_events(
foo,
bar
)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(main())
loop.run_forever()
except KeyboardInterrupt:
pass
For more examples see the examples directory
Contributing
--------------
Contributing is fantastic and much welcomed! If you have an issue, feel free to open an issue and start working on it.
If you wish to run, setup or work on documentation, you will need to install ``sphinx`` and a few related dependencies.
These can be installed with:
.. code:: sh
pip install -r doc_requirements.txt
cd docs
make html
If you wish to run linting, pylint, black and flake8 have been setup and can be run with:
.. code:: sh
python setup.py lint
Links
------
- `coc.py Documentation <https://cocpy.readthedocs.io/en/latest/?>`_
- `Official Clash of Clans API Page <https://developer.clashofclans.com/>`_
- `Clash of Clans API Discord Server <https://discord.gg/Eaja7gJ>`_
Disclaimer
-----------
This content is not affiliated with, endorsed, sponsored, or specifically
approved by Supercell and Supercell is not responsible for it.
For more information see `Supercell's Fan Content Policy. <https://www.supercell.com/fan-content-policy.>`_
Raw data
{
"_id": null,
"home_page": null,
"name": "coc.py",
"maintainer": "majordoobie, MagicTheDev, Kuchenmampfer, lukasthaler, doluk",
"docs_url": null,
"requires_python": ">=3.7.3",
"maintainer_email": null,
"keywords": "coc, clash of clans, coc.py, clash api",
"author": "mathsman5133",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/54/68/37bb253c702affab97c3daaa599ea03636e77fbf87da6fe5786fa8aa1f05/coc_py-3.6.0.tar.gz",
"platform": null,
"description": "coc.py\n======\n\n.. image:: https://discordapp.com/api/guilds/566451504332931073/embed.png\n :target: https://discord.gg/Eaja7gJ\n :alt: Discord Server Invite\n.. image:: https://img.shields.io/pypi/v/coc.py.svg\n :target: https://pypi.python.org/pypi/coc.py\n :alt: PyPI version info\n.. image:: https://img.shields.io/pypi/pyversions/discord.py.svg\n :target: https://pypi.python.org/pypi/coc.py\n :alt: PyPI supported Python versions\n\n\nEasy to use asynchronous Clash of Clans API wrapper in Python.\n\nKey Features\n-------------\n- Asynchronous code\n- Entire coverage of the official Clash of Clans API\n- Email/password login removes the stress of managing tokens\n- Optimised for speed, memory and performance\n\nGetting Started\n================\n\nInstalling\n-----------\n**Python 3.7 or higher is required**\n\n.. code:: sh\n\n # Linux/macOS\n python3 -m pip install -U coc.py\n\n # Windows\n py -3 -m pip install -U coc.py\n\n # to install the development version:\n python3 -m pip install -U git+https://github.com/mathsman5133/coc.py\n\n\nQuick Example\n--------------\nThis is the basic usage of the library.\nThis example will get a player with a certain tag, and search for 5 clans with a name.\n\n.. code:: py\n\n import asyncio\n import coc\n\n\n async def main():\n async with coc.Client() as coc_client:\n try:\n await coc_client.login(\"email\", \"password\")\n except coc.InvalidCredentials as error:\n exit(error)\n\n player = await coc_client.get_player(\"tag\")\n print(f\"{player.name} has {player.trophies} trophies!\")\n\n clans = await coc_client.search_clans(name=\"best clan ever\", limit=5)\n for clan in clans:\n print(f\"{clan.name} ({clan.tag}) has {clan.member_count} members\")\n\n try:\n war = await coc_client.get_current_war(\"#clantag\")\n print(f\"{war.clan_tag} is currently in {war.state} state.\")\n except coc.privatewarlog:\n print(\"uh oh, they have a private war log!\")\n\n if __name__ == \"__main__\":\n try:\n asyncio.run(main())\n except KeyboardInterrupt:\n pass\n\nBasic Events Example\n---------------------\nThis script will run forever, printing to the terminal\nwhenever someone joins the clan or a member of the clan donates troops.\n\n.. code:: py\n\n import asyncio\n import logging\n\n import coc\n\n\n @coc.ClanEvents.member_join()\n async def foo(player, clan):\n print(f\"{player.name} ({player.tag}) just joined {clan.name} ({clan.tag})\")\n\n\n @coc.ClanEvents.member_donations()\n async def bar(old_member, member):\n troops_donated = member.donations - old_member.donations\n print(f\"{member.name} just donated {troops_donated} troops!\")\n\n\n async def main():\n coc_client = coc.EVentsClient()\n try:\n await coc.login(\"email\", \"password\")\n except coc.InvalidCredentials as error:\n exit(error)\n\n # Register all the clans you want to monitor\n list_of_clan_tags = [\"tag1\", \"tag2\", \"tag3\"]\n coc_client.add_clan_updates(*list_of_clan_tags)\n\n # Register the callbacks for each of the events you are monitoring\n coc_client.add_events(\n foo,\n bar\n )\n\n\n if __name__ == \"__main__\":\n logging.basicConfig(level=logging.INFO)\n log = logging.getLogger()\n\n loop = asyncio.get_event_loop()\n try:\n loop.run_until_complete(main())\n loop.run_forever()\n except KeyboardInterrupt:\n pass\n\nFor more examples see the examples directory\n\nContributing\n--------------\nContributing is fantastic and much welcomed! If you have an issue, feel free to open an issue and start working on it.\n\nIf you wish to run, setup or work on documentation, you will need to install ``sphinx`` and a few related dependencies.\nThese can be installed with:\n\n.. code:: sh\n\n pip install -r doc_requirements.txt\n cd docs\n make html\n\nIf you wish to run linting, pylint, black and flake8 have been setup and can be run with:\n\n.. code:: sh\n\n python setup.py lint\n\nLinks\n------\n- `coc.py Documentation <https://cocpy.readthedocs.io/en/latest/?>`_\n- `Official Clash of Clans API Page <https://developer.clashofclans.com/>`_\n- `Clash of Clans API Discord Server <https://discord.gg/Eaja7gJ>`_\n\nDisclaimer\n-----------\nThis content is not affiliated with, endorsed, sponsored, or specifically\napproved by Supercell and Supercell is not responsible for it.\nFor more information see `Supercell's Fan Content Policy. <https://www.supercell.com/fan-content-policy.>`_\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python wrapper for the Clash of Clans API",
"version": "3.6.0",
"project_urls": {
"changelog": "https://cocpy.readthedocs.io/en/latest/miscellaneous/changelog.html",
"documentation": "https://cocpy.readthedocs.io/en/latest/",
"repository": "https://github.com/mathsman5133/coc.py"
},
"split_keywords": [
"coc",
" clash of clans",
" coc.py",
" clash api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3cd34b8653db7a4cdf1541e41d4b70df9abbd31c40f4da7af1dfce7016459b84",
"md5": "12e5bb661ea7178fbdc078693bd7d67c",
"sha256": "dd38822bf6c08c778b5c6bcca4c5016f4c4029f58091f50661e931fd98a4b9e4"
},
"downloads": -1,
"filename": "coc.py-3.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "12e5bb661ea7178fbdc078693bd7d67c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.3",
"size": 498225,
"upload_time": "2024-05-17T16:52:37",
"upload_time_iso_8601": "2024-05-17T16:52:37.032326Z",
"url": "https://files.pythonhosted.org/packages/3c/d3/4b8653db7a4cdf1541e41d4b70df9abbd31c40f4da7af1dfce7016459b84/coc.py-3.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "546837bb253c702affab97c3daaa599ea03636e77fbf87da6fe5786fa8aa1f05",
"md5": "84853e9da64476a130b10063ef7fbf28",
"sha256": "47a81adfcf986666f62e0f12eeafa6af54eab6acc95d4464f31cf8f927261db6"
},
"downloads": -1,
"filename": "coc_py-3.6.0.tar.gz",
"has_sig": false,
"md5_digest": "84853e9da64476a130b10063ef7fbf28",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.3",
"size": 454049,
"upload_time": "2024-05-17T16:52:39",
"upload_time_iso_8601": "2024-05-17T16:52:39.226550Z",
"url": "https://files.pythonhosted.org/packages/54/68/37bb253c702affab97c3daaa599ea03636e77fbf87da6fe5786fa8aa1f05/coc_py-3.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 16:52:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mathsman5133",
"github_project": "coc.py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "coc.py"
}