diff --git a/README.md b/README.md new file mode 100644 index 0000000..d40cf89 --- /dev/null +++ b/README.md @@ -0,0 +1,87 @@ + + +

Clash Royale

+ + +
+ Interact with Clash Royale APIs using python. +
+
+ + + Travis + + + + Travis + + + + Travis + + + + Travis + + + + Travis + + +
+
+
+ This library enables you to effortlessly retrieve data from either the official Clash Royale API or royaleapi.com and dynamically interact with the data recieved with an object oriented design. Asynchronous usage is also supported. +
+ +### Installation + + + +To install the library simply use [pipenv](http://pipenv.org/) (or pip, of course). + +``` +pipenv install clashroyale +``` + +### Retrieving Data + + +```py +code goes here +``` + +### Accessing Data +You can easily access data via dot notation as shown. +```py +code goes here +``` + +You can also do this blah blah +```py +more stuff +``` + +### Asynchronous Usage: + +To asynchronously make requests using aiohttp, simply use `APIClient.Async` to create the object. An example is as follows. Simply use the `await` keyword when calling api methods. + +```py +code goes here +``` + +Alternatively you can use an async with block to automatically close the session once finished. +```py +async def main(): + async with RoyaleAPI.Async('url') as client: + profile = await client.get_profile('2PP') +``` + +### [Documentation](https://clashroyale.readthedocs.io) +You can find the full API reference here (https://clashroyale.readthedocs.io) + +### License +This project is licensed under MIT + +### Contributing +Feel free to contribute to this project, a helping hand is always appreciated. Join our discord server [here](https://discord.gg/etJNHCQ). diff --git a/README.rst b/README.rst deleted file mode 100644 index 41ad065..0000000 --- a/README.rst +++ /dev/null @@ -1,47 +0,0 @@ -clashroyale -=========== - -.. image:: https://img.shields.io/pypi/v/clashroyale.svg - :target: https://pypi.org/project/clashroyale/ - :alt: PyPi - -.. image:: https://img.shields.io/pypi/pyversions/clashroyale.svg - :target: https://pypi.org/project/clashroyale/ - :alt: Supported Versions - -.. image:: https://travis-ci.com/cgrok/clashroyale.svg?branch=master - :target: https://travis-ci.com/cgrok/clashroyale - :alt: Travis CI Status - -.. image:: https://img.shields.io/github/license/cgrok/clashroyale.svg - :target: https://github.com/cgrok/clashroyale/blob/master/LICENSE - :alt: MIT License - - -This library is currently an (a)sync wrapper for -https://royaleapi.com and the official Clash Royale API with -great functionality. - -Installation -============ - -Development build - -.. code-block:: python - - pip install git+https://github.com/cgrok/clashroyale - -Stable build - -.. code-block:: python - - pip install clashroyale - -Documentation -============= - -Hosted on readthedocs.io (https://clashroyale.readthedocs.io) - -Docstrings are written using the `NumpyDoc`_ specification - -.. _NumpyDoc: https://github.com/cdgriffith/Box \ No newline at end of file diff --git a/clashroyale/official_api/client.py b/clashroyale/official_api/client.py index 2070c70..e43f535 100644 --- a/clashroyale/official_api/client.py +++ b/clashroyale/official_api/client.py @@ -113,7 +113,7 @@ async def __aenter__(self): return self async def __aexit__(self, exc_type, exc_value, traceback): - self.close() + await self.close() def __repr__(self): return ''.format(self.is_async) diff --git a/clashroyale/royaleapi/client.py b/clashroyale/royaleapi/client.py index 33b23dc..b33efc0 100644 --- a/clashroyale/royaleapi/client.py +++ b/clashroyale/royaleapi/client.py @@ -105,7 +105,7 @@ async def __aenter__(self): return self async def __aexit__(self, exc_type, exc_value, traceback): - self.close() + await self.close() def __repr__(self): return ''.format(self.is_async)