-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from 201st-Luka/new-features
some docs, guides and stability fixes and features
- Loading branch information
Showing
16 changed files
with
912 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Contributing | ||
|
||
Contributing to this open-source project is appreciated. To contribute please | ||
visit the Discord server as well. | ||
|
||
--- | ||
|
||
## Where to start | ||
|
||
The contribution starts with an issue. The created issue should explain what to | ||
do. Based on this issue you can start contributing. If so, refer to the issue in | ||
the pull request. | ||
|
||
### Issues | ||
|
||
The issues must follow these guidelines: | ||
- An issue must not be a duplicate of an existing issue. | ||
- A bug issue must provide clear information about the bug. | ||
- A feature request should contain information about what the feature should do | ||
and what it serves. | ||
|
||
Irrelevant issues, duplicates or issues failing to comply to these guidelines | ||
will be closed. | ||
|
||
### Pull requests | ||
|
||
After solving the issue it is possible to create a pull request. This pull | ||
request must target the `unstable` branch. From there it will be part of the bot | ||
in the next release. | ||
|
||
Requirements for a pull request are: | ||
- Commits must be clear | ||
- The pull request must be up-to-date with the `stable` branch | ||
- All checks (if applicable) must pass | ||
- A review must be requested from at least one developer (201st-Luka) | ||
|
||
### Recognising the contribution | ||
|
||
When the PR is merged in the `stable` branch. GitHub will automatically add the | ||
user to the repository's contributor list. It is also possible to earn a role | ||
on the Discord server for contribution. | ||
|
||
--- | ||
|
||
## Installation | ||
|
||
1. Fork the repository and copy it to your local machine. | ||
2. Install the requirements: | ||
- for developing: | ||
- [aiohttp](https://pypi.org/project/aiohttp/) (`pip install aiohttp`) | ||
|
||
You can simply do | ||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
- for testing: | ||
- [aiohttp](https://pypi.org/project/aiohttp/) (`pip install aiohttp`) | ||
- [pytest](https://pypi.org/project/pytest/) (`pip install pytest`) | ||
- [pytest-asyncio](https://pypi.org/project/pytest-asyncio/) | ||
(`pip install pytest-asyncio`) | ||
You can simply do | ||
```bash | ||
pip install -r requirements-tests.txt | ||
``` | ||
- for creating the documentation: | ||
- [mkdocs](https://pypi.org/project/mkdocs/) (`pip install mkdocs`) | ||
- [mkdocs-material](https://pypi.org/project/mkdocs-material/) | ||
(`pip install mkdocs-material`) | ||
- [mkdocstrings[python]](https://pypi.org/project/mkdocstrings/) | ||
(`pip install mkdocstrings[python]`) | ||
- [mkdocs-awesome-pages-plugin](https://pypi.org/project/mkdocs-awesome-pages-plugin/) | ||
(`pip install mkdocs-awesome-pages-plugin`) | ||
You can simply do | ||
```bash | ||
pip install -r requirements-docs.txt | ||
``` | ||
In total, you should have installed 7 packages. | ||
|
||
--- | ||
|
||
You're done! Happy coding. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
nav: | ||
- Home: index.md | ||
- API Reference: API Reference | ||
- Contributing: | ||
- CONTRIBUTING.md | ||
- contributors.md | ||
- Tutorials: Tutorials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Contributing | ||
|
||
Contributing to this open-source project is appreciated. To contribute please | ||
visit the Discord server as well. | ||
|
||
--- | ||
|
||
## Where to start | ||
|
||
The contribution starts with an issue. The created issue should explain what to | ||
do. Based on this issue you can start contributing. If so, refer to the issue in | ||
the pull request. | ||
|
||
### Issues | ||
|
||
The issues must follow these guidelines: | ||
- An issue must not be a duplicate of an existing issue. | ||
- A bug issue must provide clear information about the bug. | ||
- A feature request should contain information about what the feature should do | ||
and what it serves. | ||
|
||
Irrelevant issues, duplicates or issues failing to comply to these guidelines | ||
will be closed. | ||
|
||
### Pull requests | ||
|
||
After solving the issue it is possible to create a pull request. This pull | ||
request must target the `unstable` branch. From there it will be part of the bot | ||
in the next release. | ||
|
||
Requirements for a pull request are: | ||
- Commits must be clear | ||
- The pull request must be up-to-date with the `stable` branch | ||
- All checks (if applicable) must pass | ||
- A review must be requested from at least one developer (201st-Luka) | ||
|
||
### Recognising the contribution | ||
|
||
When the PR is merged in the `stable` branch. GitHub will automatically add the | ||
user to the repository's contributor list. It is also possible to earn a role | ||
on the Discord server for contribution. | ||
|
||
--- | ||
|
||
## Installation | ||
|
||
1. Fork the repository and copy it to your local machine. | ||
2. Install the requirements: | ||
- for developing: | ||
- [aiohttp](https://pypi.org/project/aiohttp/) (`pip install aiohttp`) | ||
|
||
You can simply do | ||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
- for testing: | ||
- [aiohttp](https://pypi.org/project/aiohttp/) (`pip install aiohttp`) | ||
- [pytest](https://pypi.org/project/pytest/) (`pip install pytest`) | ||
- [pytest-asyncio](https://pypi.org/project/pytest-asyncio/) | ||
(`pip install pytest-asyncio`) | ||
You can simply do | ||
```bash | ||
pip install -r requirements-tests.txt | ||
``` | ||
- for creating the documentation: | ||
- [mkdocs](https://pypi.org/project/mkdocs/) (`pip install mkdocs`) | ||
- [mkdocs-material](https://pypi.org/project/mkdocs-material/) | ||
(`pip install mkdocs-material`) | ||
- [mkdocstrings[python]](https://pypi.org/project/mkdocstrings/) | ||
(`pip install mkdocstrings[python]`) | ||
- [mkdocs-awesome-pages-plugin](https://pypi.org/project/mkdocs-awesome-pages-plugin/) | ||
(`pip install mkdocs-awesome-pages-plugin`) | ||
You can simply do | ||
```bash | ||
pip install -r requirements-docs.txt | ||
``` | ||
In total, you should have installed 7 packages. | ||
|
||
--- | ||
|
||
You're done! Happy coding. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Installation | ||
|
||
## Requirements | ||
|
||
To use the [PyClasher](../index.md)-package you need Python 3.8 or higher. | ||
|
||
## Installation | ||
|
||
The package is accessible on [PyPi.org](https://pypi.org) so you can install the package | ||
using | ||
```bash | ||
pip install pyclasher | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Setting up a Client | ||
|
||
The [Client][client_ref] | ||
is the heard of this package. It allows to make the requests. | ||
|
||
## The client | ||
|
||
The [Client][client_ref] uses API tokens that you can obtain from the official | ||
[ClashOfClans developer portal](https://developer.clashofclans.com/#/). Those tokens serve as a verification to | ||
the ClashOfClans API. It is sufficient to create an account and create one or | ||
multiple tokens. | ||
|
||
## Setting up | ||
|
||
### With tokens | ||
|
||
To set up a client, you need to import the [Client][client_ref] from | ||
`pyclasher.client` and adding the tokens to it: | ||
|
||
```python | ||
import asyncio | ||
|
||
from pyclasher.client import Client | ||
|
||
|
||
my_tokens = [ | ||
"enter your first token here", | ||
"enter the other tokens here separated as strings in a list" | ||
] | ||
|
||
my_client = Client(tokens=my_tokens) | ||
|
||
async def main(): | ||
# starting the client | ||
await my_client.start() | ||
|
||
# doing requests here | ||
... | ||
|
||
# stopping the client | ||
await my_client.close() | ||
|
||
asyncio.run(main()) | ||
``` | ||
|
||
!!! note | ||
It is recommended to use environment variables for the tokens. So you can | ||
make sure that the tokens are never leaked on the Internet or on GitHub, ... | ||
|
||
### With ClashOfClans developer account | ||
|
||
It is also possible to set up a client using the login data from | ||
https://developer.clashofclans.com/#/login. | ||
|
||
```python | ||
import asyncio | ||
|
||
from pyclasher.client import Client | ||
|
||
|
||
my_email = "email@example.com" | ||
my_password = "examplePassword1234" | ||
|
||
async def login(): | ||
return await Client.from_login( | ||
my_email, my_password, | ||
login_count=1 # this parameter is used to log in multiple times to the | ||
# ClashOfClans developer portal and create multiple tokens | ||
) | ||
|
||
async def main(): | ||
my_client = await login() | ||
|
||
# starting the client | ||
await my_client.start() | ||
|
||
# requests | ||
... | ||
|
||
# stopping the client | ||
await my_client.close() | ||
``` | ||
|
||
!!! warning | ||
This is an alternative method to get tokens. Those tokens are temporarily | ||
and expire after one hour. It is intended for testing purpose only. | ||
An implementation to renew the tokens after one hour will not ever happen. | ||
Use [tokens](#with-tokens) for production purpose. | ||
|
||
|
||
|
||
<!---links---> | ||
[client_ref]: ../API%20Reference/client/client.md#pyclasher.client.client.Client | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Requests | ||
|
||
The requests defined in this package are a user-friendly implementation of | ||
requesting and getting data of the official ClashOfClans-API. The requests | ||
return models that are some kind of wrapper for the data that hides behind the | ||
models. Those models have error handling and are easier to use than raw JSON | ||
data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Contributors | ||
|
||
## Project owner | ||
|
||
- [201st-Luka](https://github.com/201st-Luka) | ||
|
||
## Contributors | ||
|
||
No contributors yet. In the future, contributors are going to be added here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.