# Clashpy Python Package
The **Clashpy** Python package provides a simple and convenient way to interact with the Clash of Clans API, allowing you to retrieve information about clans and players in the Clash of Clans game.
## Installation
You can install the Clashpy package using pip:
```bash
pip install clashpy
```
## Usage
1. Import the necessary classes from the package:
```python
import clashpy
api_key = "your_api_key_here"
```
2. Create an instance of the `Connect` class with your API key:
```python
connect = clashpy.Connect(api_key)
```
3. Create instances of `Clan` or `Player` using the `clan` and `player` methods of the `Connect` instance:
```python
# Example for Clan
clan_id = "#2YVQ0VJ8P"
clan = connect.clan(clan_id)
members, chat = clan.info("members", "chatLanguage")
warlog = clan.warlog()
# Example for Player
player_tag = "#PJ2ULUGQ0"
my_player = connect.player(player_tag)
heroes, exp = my_player.info("heroes", "expLevel")
```
4. Use the created instances to retrieve information about clans and players.
## Classes
### `Connect`
The `Connect` class is used to create instances of the `Clan` and `Player` classes, and takes your Clash of Clans API key as an argument.
#### Methods:
- `clan(tag)`: Create an instance of the `Clan` class with the specified clan tag.
- `player(tag)`: Create an instance of the `Player` class with the specified player tag.
### `Clan`
The `Clan` class allows you to retrieve information about a Clash of Clans clan.
#### Methods:
- `info(*args)`: Retrieve clan information for the specified attributes. Pass attribute names as arguments to get specific data.
- `members()`: Retrieve a list of clan members.
- `warlog()`: Retrieve the war log for the clan.
- `capitalraidseasons()`: Retrieve the capital raid seasons for the clan.
- `currentwar()`: Retrieve information about the clan's current war.
- `warleague()`: Retrieve information about the clan's current war league group.
- `warleaguewars()`: Retrieve information about the clan's war league wars.
#### Available Arguments:
- `tag`
- `name`
- `type`
- `description`
- `location`
- `isFamilyFriendly`
- `badgeUrls`
- `clanLevel`
- `clanPoints`
- `clanBuilderBasePoints`
- `clanVersusPoints`
- `clanCapitalPoints`
- `capitalLeague`
- `requiredTrophies`
- `warFrequency`
- `warWinStreak`
- `warWins`
- `isWarLogPublic`
- `warLeague`
- `members`
- `memberList`
- `labels`
- `requiredBuilderBaseTrophies`
- `requiredVersusTrophies`
- `requiredTownhallLevel`
- `clanCapital`
- `chatLanguage`
### `Player`
The `Player` class allows you to retrieve information about a Clash of Clans player.
#### Methods:
- `info(*args)`: Retrieve player information for the specified attributes. Pass attribute names as arguments to get specific data.
#### Available Arguments:
- `tag`
- `name`
- `townHallLevel`
- `townHallWeaponLevel`
- `expLevel`
- `trophies`
- `bestTrophies`
- `warStars`
- `attackWins`
- `defenseWins`
- `builderHallLevel`
- `builderBaseTrophies`
- `versusTrophies`
- `bestBuilderBaseTrophies`
- `bestVersusTrophies`
- `versusBattleWins`
- `role`
- `warPreference`
- `donations`
- `donationsReceived`
- `clanCapitalContributions`
- `clan`
- `league`
- `builderBaseLeague`
- `achievements`
- `playerHouse`
- `labels`
- `troops`
- `heroes`
- `spells`
## Example
```python
import clashpy
api_key = "your_api_key_here"
connect = clashpy.Connect(api_key)
# Retrieve clan and player information
clan_id = "#2YVQ0VJ8P"
clan = connect.clan(clan_id)
members, chat = clan.info("members", "chatLanguage")
warlog = clan.warlog()
player_tag = "#PJ2ULUGQ0"
my_player = connect.player(player_tag)
heroes, exp = my_player.info("heroes", "expLevel")
```
## Contributing
Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.
## License
This package is open-source and available under the [MIT License](LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/agilarasu/clashpy",
"name": "clashpy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "clashpy,Clash of Clans,API",
"author": "Agilarasu",
"author_email": "s.agilarasu@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/5b/57/2cd419f6704dc42d7723ef83b78cf90575d0fd1db839c8256128dd8527cc/clashpy-1.0.2.tar.gz",
"platform": null,
"description": "# Clashpy Python Package\n\nThe **Clashpy** Python package provides a simple and convenient way to interact with the Clash of Clans API, allowing you to retrieve information about clans and players in the Clash of Clans game.\n\n## Installation\n\nYou can install the Clashpy package using pip:\n\n```bash\npip install clashpy\n```\n\n## Usage\n\n1. Import the necessary classes from the package:\n\n```python\nimport clashpy\n\napi_key = \"your_api_key_here\"\n```\n\n2. Create an instance of the `Connect` class with your API key:\n\n```python\nconnect = clashpy.Connect(api_key)\n```\n\n3. Create instances of `Clan` or `Player` using the `clan` and `player` methods of the `Connect` instance:\n\n```python\n# Example for Clan\nclan_id = \"#2YVQ0VJ8P\"\nclan = connect.clan(clan_id)\nmembers, chat = clan.info(\"members\", \"chatLanguage\")\nwarlog = clan.warlog()\n\n# Example for Player\nplayer_tag = \"#PJ2ULUGQ0\"\nmy_player = connect.player(player_tag)\nheroes, exp = my_player.info(\"heroes\", \"expLevel\")\n```\n\n4. Use the created instances to retrieve information about clans and players.\n\n## Classes\n\n### `Connect`\n\nThe `Connect` class is used to create instances of the `Clan` and `Player` classes, and takes your Clash of Clans API key as an argument.\n\n#### Methods:\n\n- `clan(tag)`: Create an instance of the `Clan` class with the specified clan tag.\n- `player(tag)`: Create an instance of the `Player` class with the specified player tag.\n\n### `Clan`\n\nThe `Clan` class allows you to retrieve information about a Clash of Clans clan.\n\n#### Methods:\n\n- `info(*args)`: Retrieve clan information for the specified attributes. Pass attribute names as arguments to get specific data.\n- `members()`: Retrieve a list of clan members.\n- `warlog()`: Retrieve the war log for the clan.\n- `capitalraidseasons()`: Retrieve the capital raid seasons for the clan.\n- `currentwar()`: Retrieve information about the clan's current war.\n- `warleague()`: Retrieve information about the clan's current war league group.\n- `warleaguewars()`: Retrieve information about the clan's war league wars.\n\n#### Available Arguments:\n\n- `tag`\n- `name`\n- `type`\n- `description`\n- `location`\n- `isFamilyFriendly`\n- `badgeUrls`\n- `clanLevel`\n- `clanPoints`\n- `clanBuilderBasePoints`\n- `clanVersusPoints`\n- `clanCapitalPoints`\n- `capitalLeague`\n- `requiredTrophies`\n- `warFrequency`\n- `warWinStreak`\n- `warWins`\n- `isWarLogPublic`\n- `warLeague`\n- `members`\n- `memberList`\n- `labels`\n- `requiredBuilderBaseTrophies`\n- `requiredVersusTrophies`\n- `requiredTownhallLevel`\n- `clanCapital`\n- `chatLanguage`\n\n### `Player`\n\nThe `Player` class allows you to retrieve information about a Clash of Clans player.\n\n#### Methods:\n\n- `info(*args)`: Retrieve player information for the specified attributes. Pass attribute names as arguments to get specific data.\n\n#### Available Arguments:\n\n- `tag`\n- `name`\n- `townHallLevel`\n- `townHallWeaponLevel`\n- `expLevel`\n- `trophies`\n- `bestTrophies`\n- `warStars`\n- `attackWins`\n- `defenseWins`\n- `builderHallLevel`\n- `builderBaseTrophies`\n- `versusTrophies`\n- `bestBuilderBaseTrophies`\n- `bestVersusTrophies`\n- `versusBattleWins`\n- `role`\n- `warPreference`\n- `donations`\n- `donationsReceived`\n- `clanCapitalContributions`\n- `clan`\n- `league`\n- `builderBaseLeague`\n- `achievements`\n- `playerHouse`\n- `labels`\n- `troops`\n- `heroes`\n- `spells`\n\n## Example\n\n```python\nimport clashpy\n\napi_key = \"your_api_key_here\"\nconnect = clashpy.Connect(api_key)\n\n# Retrieve clan and player information\nclan_id = \"#2YVQ0VJ8P\"\nclan = connect.clan(clan_id)\nmembers, chat = clan.info(\"members\", \"chatLanguage\")\nwarlog = clan.warlog()\n\nplayer_tag = \"#PJ2ULUGQ0\"\nmy_player = connect.player(player_tag)\nheroes, exp = my_player.info(\"heroes\", \"expLevel\")\n```\n\n## Contributing\n\nContributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.\n\n## License\n\nThis package is open-source and available under the [MIT License](LICENSE).\n",
"bugtrack_url": null,
"license": "",
"summary": "A Python package to interact with the Clash of Clans API",
"version": "1.0.2",
"project_urls": {
"Bug Tracker": "https://github.com/agilarasu/clashpy/issues",
"Documentation": "https://github.com/agilarasu/clashpy/docs",
"Homepage": "https://github.com/agilarasu/clashpy"
},
"split_keywords": [
"clashpy",
"clash of clans",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4da86b99bbe7b7449ffab303cd0de8bc03c9508eb2daeaabcf1b5bb1f02b9628",
"md5": "78d1e874a754f8c5f21c641199babcd6",
"sha256": "226861a445d8b8c7f96069b1f921a499d83f667c14d167513a60880c57cdb01d"
},
"downloads": -1,
"filename": "clashpy-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "78d1e874a754f8c5f21c641199babcd6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4538,
"upload_time": "2023-09-25T06:14:18",
"upload_time_iso_8601": "2023-09-25T06:14:18.281100Z",
"url": "https://files.pythonhosted.org/packages/4d/a8/6b99bbe7b7449ffab303cd0de8bc03c9508eb2daeaabcf1b5bb1f02b9628/clashpy-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5b572cd419f6704dc42d7723ef83b78cf90575d0fd1db839c8256128dd8527cc",
"md5": "fdad66a4119c04f8fc6d06427e54d347",
"sha256": "057b838d8be9ccbb5540dc8c8c195e39093cecbaf4a90b243fb0e18e0e53d300"
},
"downloads": -1,
"filename": "clashpy-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "fdad66a4119c04f8fc6d06427e54d347",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3716,
"upload_time": "2023-09-25T06:14:19",
"upload_time_iso_8601": "2023-09-25T06:14:19.819460Z",
"url": "https://files.pythonhosted.org/packages/5b/57/2cd419f6704dc42d7723ef83b78cf90575d0fd1db839c8256128dd8527cc/clashpy-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-25 06:14:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "agilarasu",
"github_project": "clashpy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "clashpy"
}