From 282763df90cb9ba5a20118e0728738e6a901d5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jero=CC=81nimo=20Albi?= Date: Wed, 1 Mar 2017 19:46:48 +0100 Subject: [PATCH] Version update to `1.0.0` --- CHANGELOG.md | 8 ++++++++ CONTRIBUTING.md | 11 +++++++++++ README.md | 26 +++++++++++++------------- katana/__init__.py | 2 +- 4 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3c6765a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Change Log +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [1.0.0] - 2017-03-01 +- Initial release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..faf3fcd --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ +Contributing +------------ + +Please first read our [contribution guidelines](https://kusanagi.io/app#katana/open-source/contributing). + +* [Requesting help](https://kusanagi.io/app#katana/open-source/help) +* [Reporting a bug](https://kusanagi.io/app#katana/open-source/bug) +* [Submitting a patch](https://kusanagi.io/app#katana/open-source/patch) +* [Security issues](https://kusanagi.io/app#katana/open-source/security) + +We use [milestones](https://github.com/kusanagi/katana-sdk-python3/milestones) to track upcoming releases inline with our [versioning](https://kusanagi.io/app#katana/versioning) strategy, and as defined in our [roadmap](https://kusanagi.io/app#katana/roadmap). diff --git a/README.md b/README.md index 9b982a1..7214ab9 100644 --- a/README.md +++ b/README.md @@ -101,12 +101,12 @@ LOG = logging.getLogger('katana') def request_handler(request): return request - - + + def response_handler(response): return response - - + + if __name__ == '__main__': middleware = Middleware() middleware.request(request_handler) @@ -118,7 +118,7 @@ Now, save the module as `middleware-example.py`. This module defines a **Middleware** that processes requests and also responses, so it's called two times per request. -The `request_handler` is called first, before any **Service** call, so there we have to set the **Service** name, version and action to call. +The `request_handler` is called first, before any **Service** call, so there we have to set the **Service** name, version and action to call. To do so, change the `request_handler` function to the following: @@ -127,15 +127,15 @@ def request_handler(request): http_request = request.get_http_request() path = http_request.get_url_path() LOG.info('Pre-processing request to URL %s', path) - + # Debug logs can also be written with the framework request.log('Pre-processing request to URL {}'.format(path)) - + # These values would normally be extracted by parsing the URL request.set_service_name('users') request.set_service_version('0.1') request.set_action_name('read') - + return request ``` @@ -149,12 +149,12 @@ For the example, all responses will be formatted as JSON. To do so, change the ` def response_handler(response): http_response = response.get_http_response() http_response.set_header('Content-Type', 'application/json') - + # Serialize transport to JSON and use it as response body transport = response.get_transport() body = json.dumps(transport.get_data()) http_response.set_body(body) - + return response ``` @@ -168,7 +168,7 @@ from katana.sdk import Service def read_handler(action): user_id = action.get_param('id').get_value() - + # Users read action returns a single user entity action.set_entity({ 'id': user_id, @@ -177,8 +177,8 @@ def read_handler(action): 'last_name': 'Bar', }) return action - - + + if __name__ == '__main__': service = Service() service.action('read', read_handler) diff --git a/katana/__init__.py b/katana/__init__.py index 9aed84b..300328b 100644 --- a/katana/__init__.py +++ b/katana/__init__.py @@ -12,4 +12,4 @@ __license__ = "MIT" __copyright__ = "Copyright (c) 2016-2017 KUSANAGI S.L. (http://kusanagi.io)" -__version__ = '1.0.0-beta.14' +__version__ = '1.0.0'