Skip to content

Commit

Permalink
Bump versions to v0.1.0 and fix formatting for changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
mathsman5133 committed Apr 21, 2019
1 parent 5f31c78 commit b0d643c
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 60 deletions.
2 changes: 1 addition & 1 deletion coc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

__version__ = '0.0.6'
__version__ = '0.1.0'

from .client import Client
from .dataclasses import (
Expand Down
121 changes: 63 additions & 58 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,99 +10,104 @@ v0.1.0
---------
BugFixes
~~~~~~~~~~
- Fixed bug with 'reloading' the client in the same script with
loop.run_until_complete() raising runtime error
- Add a more specific error `aiohttp.ContentTypeError` to be raised
if trying to parse non-json response.
- Fixed bug with loops breaking when reloading the client in a discord cog.
- A more specific error, `aiohttp.ContentTypeError` is raised when parsing non-json responses.

Important
~~~~~~~~~~~
- Big thanks to Jab for some of these.

- Big one! Client now only accepts an email/password pair rather than tokens.
This pair is what you use to login to https://developer.clashofclans.com/#/login
and will allow the client to automatically use, create, reset and find tokens,
making it a much more streamlined process.
This pair is what you use to login to https://developer.clashofclans.com/#/login
and will allow the client to automatically use, create, reset and find tokens,
making it a much more streamlined process.

Big thanks to Jab for authoring a lot of this.

- As such, the following parameters to client have been added:

- ``key_count``: int: the number of tokens to rotate between when making API requests.
This defaults to 1, and can be between 1 and 10
This defaults to 1, and can be between 1 and 10

- ``key_names``: str: The name to use when creating tokens on the developer page.
This defaults to `Created with coc.py Client`
This defaults to `Created with coc.py Client`

- Email and Password are now mandatory parameters and must be passed

- `update_tokens` parameter has been removed. The client will automatically reset bad tokens.

- In order to keep consistency with the official API docs, `token` has been renamed to `key`.
This affects the following method/parameters:
This affects the following method/parameters:

``on_token_reset(new_token)`` --> ``on_key_reset(new_key)``
``HTTPClient.login()`` --> ``HTTPClient.get_keys()``
- ``on_token_reset(new_token)`` --> ``on_key_reset(new_key)``
- ``HTTPClient.login()`` --> ``HTTPClient.get_keys()``

and otherwise consistent use of `key` during internals, docs, code and examples.
and otherwise consistent use of `key` during internals, docs, code and examples.

- `pytz` and `python-dateutil` have both been removed as dependencies due to the ability to
parse timestamps manually. This has been added to utils as a function: ``from_timestamp(ts)``,
returning a utc-datetime object.
parse timestamps manually. This has been added to utils as a function: ``from_timestamp(ts)``,
returning a utc-datetime object.

- Dataclasses have received a makeover! Many new attributes are present, these are listed below.
Most importantly, any property beginning with an underscore (_) use and return iterator objects.
These are **not** lists, and relevant python documentation is here:
https://docs.python.org/3/glossary.html#term-iterator. These are up to 12x faster than lists, and
as such for those who are concerned about speed, performance and memory should use these, while
for the majority, calling the regular property should be fine (usually returning a list rather than iter).

- :attr:`SearchClan._members`
- :attr:`WarClan._members`
- :attr:`WarClan._attacks`
- :attr:`WarClan._defenses`
- :attr:`WarMember._attacks`
- :attr:`WarMember._defenses`
- :attr:`SearchPlayer._achievements`
- :attr:`CurrentWar._attacks`
- :attr:`CurrentWar._members`
- :attr:`LeagueClan._members`
- :attr:`LeagueGroup._clans`
Most importantly, any property beginning with an underscore (_) use and return iterator objects.
These are **not** lists, and relevant python documentation is here:
https://docs.python.org/3/glossary.html#term-iterator.

These are up to 12x faster than lists, and
as such for those who are concerned about speed, performance and memory should use these, while
for the majority, calling the regular property should be fine (usually returning a list rather than iter).

- :attr:`SearchClan._members`
- :attr:`WarClan._members`
- :attr:`WarClan._attacks`
- :attr:`WarClan._defenses`
- :attr:`WarMember._attacks`
- :attr:`WarMember._defenses`
- :attr:`SearchPlayer._achievements`
- :attr:`CurrentWar._attacks`
- :attr:`CurrentWar._members`
- :attr:`LeagueClan._members`
- :attr:`LeagueGroup._clans`

- The following **new** attributes were added:

- :attr:`SearchClan.member_dict`
- :attr:`WarClan.member_dict`
- :attr:`WarClan.attacks`
- :attr:`WarClan.defenses`
- :attr:`WarMember.attacks`
- :attr:`WarMember.defenses`
- :attr:`SearchPlayer.achievements_dict`
- :attr:`SearchPlayer.troops_dict`
- :attr:`SearchPlayer.heroes_dict`
- :attr:`SearchPlayer.spells_dict`
- :attr:`Timestamp.time`
- :attr:`SearchClan.member_dict`
- :attr:`WarClan.member_dict`
- :attr:`WarClan.attacks`
- :attr:`WarClan.defenses`
- :attr:`WarMember.attacks`
- :attr:`WarMember.defenses`
- :attr:`SearchPlayer.achievements_dict`
- :attr:`SearchPlayer.troops_dict`
- :attr:`SearchPlayer.heroes_dict`
- :attr:`SearchPlayer.spells_dict`
- :attr:`Timestamp.time`


- The folowwing **new** methods were added:

- :func:`SearchClan.get_member(tag)`
- :func:`CurrentWar.get_member(tag)`
- `SearchClan.get_member(tag)`
- `CurrentWar.get_member(tag)`

- New utility functions:

- :func:`utils.get(iterable, **attrs)
- `utils.get(iterable, **attrs)`
- Searches the iterable until a value with the given attribute is found.
Unlike ``filter()``, this will return when the first value is found.
- :func:`utils.find(function, iterable)
Unlike ``filter()``, this will return when the first value is found.
- `utils.find(function, iterable)`
- Searches through the iterable until a value which satisfies the function is found.

- :func:`from_timestamp(ts)`
- `from_timestamp(ts)`
- Parses an ISO8601 timestamp as returned by the COC API into a datetime object


Documentation:
---------------
~~~~~~~~~~~~~~~~
- Many docstrings were reformatted or worded, with punctuation and other typo's fixed
- All new properties, attributes and methods have been documented.
- Update some examples, including a `clan_info` function in discord bots (Thanks, Tuba).




v0.0.6
--------
BugFixes
Expand Down Expand Up @@ -143,17 +148,17 @@ BugFixes
~~~~~~~~~
- Fix some problems comparing naive and aware timestamps in :class:`.Timestamp`
- Add a private ``_data`` attribute to all data classes.
This is the json as the API returns it. It makes ``json=True`` parameters in
requests easy to handle.
This is the json as the API returns it. It makes ``json=True`` parameters in
requests easy to handle.
- Only cache complete clan results - ie. ``Client.search_clans`` only returned a :class:`BasicClan`,
so in order to add some cache consistency, cached clans now only contain :class:`SearchClan`.
so in order to add some cache consistency, cached clans now only contain :class:`SearchClan`.

Important
~~~~~~~~~~
- New Class - :class:`.LeagueWarLogEntry` is similar to :class:`WarLog`, however it has it's own
set of attributes to ensure it is easier to use and know which ones are present and not.
set of attributes to ensure it is easier to use and know which ones are present and not.
- This new class is utilised in ``Client.get_warlog``, which returns a ``list`` of both
``LeagueWarLogEntry`` and ``WarLog``, depending on the war.
``LeagueWarLogEntry`` and ``WarLog``, depending on the war.

Documentation
~~~~~~~~~~~~~~
Expand All @@ -169,7 +174,7 @@ BugFixes
- Fix some attributes from inherited classes not being present
- Fix some :exc:`AttributeError` from being thrown due to incomplete data from API
- When a clan is not in war, :class:`.WarClan` will not be present.
Some errors were being thrown due to incomplete data being given from API
Some errors were being thrown due to incomplete data being given from API
- Allow for text-only responses from API (ie. not json)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
with open(os.path.join(os.getcwd(), 'requirements.txt')) as f:
requirements = f.read().splitlines()

version = '0.0.6'
version = '0.1.0'

readme = ''
with open('README.rst') as f:
Expand Down

0 comments on commit b0d643c

Please sign in to comment.