Although this release does not include as much interesting new features as previous release does, it still can be considered as a big release. I spent my whole weekend looking for ways to improve ease of usage and find bugs, and here is the result. All changes are available below:
New features
- Support for `logging` module is here! Now you can set the logging level in `logging_level` argument of `__init__` function of Client object; in other words, when creating the Client object, you can pass the logging level limitation you want to the `logging_level` argument. Information logs such as completion of the request to the API will be logged as INFO and other logs such as skipping attributes which does not support the language of the text will be logged as DEBUG.
- Added `change_token` function to Client object which can be used to change the token without recreating the Client object.
- Added `sort_by` argument to `perspective.utils.format_response` which takes whether `ascending` or `descending` as value (literal value), which can be used to sort the attributes according to their score values ascending or descending.
- Added `return_raw` argument to `analyze` function of Client object which can be used to make the function return the raw response instead of a simplified response.
- Added support for processing raw responses in `response` argument of every single function in `perspective.utils` class.
- Added new exception types for specification of errors that occur whilst making a request to the API or whilst checking validity of arguments locally.
Changes
- Exceptions no more include the parent exception with a message "During handling of the above exception, another exception occurred:".
- Removed "Error" suffix from all exception names, for example, `UnknownAttributeError` is now `UnknownAttribute`.
- Made `filename` attribute of `save_graph` function in `perspective.utils` class non-required and default to "chart.png".
Bug fixes
- Fixed `UnknownAttribute` error when multiple attribute groups (such as `perspective.Attributes.All` and/or `perspective.Attributes.Production`) used in `attributes` argument of `analyze` function in Client object.
- Fixed `show_graph` and `save_graph` functions drawing grid lines onto the bar chart no matter what value `grid_lines` argument gets unless `False` is given to `grid_lines` argument of those functions.
Code changes
- Moved all exception classes from `main.py` to a new file named `error.py`.
- Fixed spelling, grammar and argument name mistakes in function comments.
- Included license information in every single *.py file except `__init__.py` and updated the copyright year in license text.
- Moved variables which hold lists of all attributes and/or all attribute groups to `attributes.py` as a global variable outside the Attributes class, for simplification of main code.