Skip to content

Commit 84ad507

Browse files
authored
Merge pull request #23 from 201st-Luka/correcting_errors
Correcting errors
2 parents a7c0665 + 928843a commit 84ad507

47 files changed

Lines changed: 1504 additions & 549 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 838 additions & 0 deletions
Large diffs are not rendered by default.

.github/PyClasher.png

476 KB
Loading

README.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[![Discord][discord_shield]][discord_url] ![Last commit][last_commit_shield]
22

3-
# PyClasher
3+
![PyClasher](.github/PyClasher.png)
44

5-
---
5+
# PyClasher
66

7-
pyclasher is the name of the asynchronous ClashOfClans API. It is
7+
PyClasher is the name of the asynchronous ClashOfClans API. It is
88
an object-oriented wrapper client that provides easy access to the
99
requested data.
1010

@@ -18,9 +18,16 @@ a python package and will be available for everyone.
1818
If you have any questions, feel free to join my discord server
1919
to ask you question.
2020

21+
## Installation
22+
23+
It is possible to install the package from GitHib releases. You can use the following command to add PyClasher to your library:
24+
```bash
25+
pip install git+https://github.com/201st-Luka/PyClasher.git@v0.0.1-alpha3
26+
```
27+
2128
---
2229

23-
### Features
30+
## Features
2431
- Asynchronous and parallel requesting
2532
- Possibility to use multiple tokens and to login via email address
2633
and password of the ClashOfClans developer portal
@@ -31,11 +38,34 @@ used tokens
3138

3239
---
3340

34-
### Future
41+
## Contributing
42+
43+
Feel free to contribute to the repository.
44+
45+
You can fork the repository and commit your changes in a pull request. Please consider to check out the
46+
[Discord server][discord_url] if so.
47+
48+
---
49+
50+
## Future
3551

3652
I'm planning to keep the API wrapper up to date and improve it as
3753
good as I can.
3854

55+
### Planned features
56+
57+
- more bulk requests
58+
- pytests for every request
59+
- pytests for the models
60+
- possibility to download files (images, etc) from `api-assets.clashofclans.com`
61+
62+
### Planned utils
63+
64+
- documentation
65+
- real example ([HeadhunterBot][headhunterbot_url] is in development)
66+
67+
---
68+
3969
If you find a bug, an error or want custom functionality, please tell
4070
me via Discord or open an issue or start a discussion on the
4171
GitHub-repository.
@@ -45,4 +75,5 @@ GitHub-repository.
4575
<!---links--->
4676
[discord_shield]: https://img.shields.io/badge/Discord-blue?logo=discord&logoColor=white
4777
[discord_url]: https://discord.gg/j2PAF9Wru8
48-
[last_commit_shield]: https://img.shields.io/github/last-commit/201st-Luka/HeadhunterBot
78+
[last_commit_shield]: https://img.shields.io/github/last-commit/201st-Luka/HeadhunterBot
79+
[headhunterbot_url]: https://github.com/201st-Luka/HeadhunterBot

pyclasher/bulk_requests/BulkPlayer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def tags(self):
2020

2121
@classmethod
2222
async def _async_from_clan(cls, clan):
23-
members = await ClanMembersRequest(clan.tag).request() if isinstance(clan, BaseClan) else await ClanMembersRequest(clan).request()
23+
members = await (ClanMembersRequest(clan.tag).request() if isinstance(clan, BaseClan) else
24+
await ClanMembersRequest(clan).request())
2425
return cls.from_member_list(members)
2526

2627
@classmethod

pyclasher/bulk_requests/BulkPlayer.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Iterable, Coroutine, Any
1+
from typing import Iterable, Coroutine, Any, Iterator
22

33
from .BulkRequestModel import BulkRequestModel
44
from ..models import BaseClan, ClanMemberList, ClanWarMemberList, ClanWarLeagueClanMemberList, ClanCapitalRaidSeasonMemberList
@@ -75,6 +75,9 @@ class PlayerBulkRequest(BulkRequestModel):
7575
"""
7676
...
7777

78+
def __iter__(self) -> Iterator[PlayerRequest]:
79+
...
80+
7881
def __next__(self) -> PlayerRequest:
7982
"""
8083
returns the next player of the bulk request if an iterator is used

pyclasher/bulk_requests/BulkRequestModel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ def __str__(self):
4747
return f"{self.__class__.__name__}({self._main_attribute})"
4848

4949
def __repr__(self):
50-
return f"{self.__class__.__name__}({', '.join(('='.join((key, str(value))) for key, value in self.__get_properties().items()))})"
50+
return (f"{self.__class__.__name__}"
51+
f"({', '.join(('='.join((key, str(value))) for key, value in self.__get_properties().items()))})")

pyclasher/bulk_requests/BulkRequestModel.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Coroutine
1+
from typing import Any, Coroutine, Iterator
22

33

44
class BulkRequestModel:
@@ -80,7 +80,7 @@ class BulkRequestModel:
8080
def __getitem__(self, item: int) -> _request_model:
8181
...
8282

83-
def __iter__(self):
83+
def __iter__(self) -> Iterator[_request_model]:
8484
self._iter = iter(self._requests)
8585
...
8686

pyclasher/models/BaseModels.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
base models for this API wrapper client
33
"""
44

5-
from typing import Any
5+
from typing import Any, Iterator
66

77
from ..Exceptions import MISSING, Missing
88

@@ -126,8 +126,9 @@ class IterBaseModel:
126126
def __getitem__(self, item: int) -> _iter_rtype:
127127
...
128128

129-
def __iter__(self) -> IterBaseModel:
129+
def __iter__(self) -> Iterator[_iter_rtype]:
130130
self._iter = iter(self._data)
131+
...
131132

132133
def __next__(self):
133134
...

0 commit comments

Comments
 (0)