This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# flask_nameko

A wrapper for using nameko services with Flask

## Installation

Install it via Clef's PyPI:

pip install flask_nameko

## Usage

To start using `flask_nameko`, you need to create and configure a new `FlaskPooledClusterRpcProxy` singleton, which you'll use to communicate with your Nameko cluster.

# __init__.py
from flask import Flask
from flask_nameko import FlaskPooledClusterRpcProxy

rpc = FlaskPooledClusterRpcProxy()

def create_app():
app = Flask(__name__)
app.config.update(dict(
NAMEKO_AMQP_URI='amqp://localhost'
))

rpc.init_app(app)

app = create_app()

Then, you can use the `FlaskPooledClusterRpcProxy` singleton just as you would normally use a `ClusterRpcProxy`, by accessing individual services by name and calling methods on them:

# routes.py

from . import (
app,
rpc
)

@app.route('/'):
def index():
result = rpc.service.do_something('test')
return result

## API

### Configuration

`FlaskPooledClusterRpcProxy` accepts all nameko configuration values, prefixed with the `NAMEKO_` prefix. In addition, it exposes additional configuration options:

* `NAMEKO_INITIAL_CONNECTIONS (int, default=2)` - the number of initial connections to the Nameko cluster to create
* `NAMEKO_MAX_CONNECTIONS (int, default=8)` - the max number of connections to the Nameko cluster to create before raises an error
* `NAMEKO_CONNECT_ON_METHOD_CALL (bool, default=True)` - whether connections to services should be loaded when the service is accessed (False) or when a method is called on a service (True)
* `NAMEKO_RPC_TIMEOUT` (int, default=None) - the default timeout before raising an error when trying to call a service RPC method
* `NAMEKO_POOL_RECYCLE` (int, default=None) - if specified, connections that are older than this interval, specified in seconds, will be automatically recycled on checkout. This setting is useful for environments where connections are happening through a proxy like HAProxy which automatically closes connections after a specified interval.

### Proxies

*flask_nameko.**FlaskPooledClusterRpcProxy**(app=None, connect_on_method_call=True)*

This class is used to create a pool of connections to a Nameko cluster. It provides the following options:

* `connect_on_method_call` - if this is true, the connection to a service is created when a method is called on a service rather than when the service is accessed

*init_app(app=None)*

Configure the proxy for a given app.

## Development

$ git clone git@github.com:clef/flask_nameko.git flask_nameko
$ cd flask_nameko
$ make develop


=======
History
=======

`1.3.0 <https: github.com="" clef="" flask-nameko="" compare="" v1.2.0...v1.3.0="">`__ (2016-09-20)
-------------------------------------------------------------------------------------

Documentation
~~~~~~~~~~~~~

- **README**: adds docs for NAMEKO\_POOL\_RECYCLE
(`a27a1be <https: github.com="" clef="" flask-nameko="" commit="" a27a1be="">`__)

Features
~~~~~~~~

- **ConnectionPool**: add pool recycling to eliminate closed connection
issue
(`4d90f1d <https: github.com="" clef="" flask-nameko="" commit="" 4d90f1d="">`__)

`1.2.0 <https: github.com="" clef="" flask-nameko="" compare="" v1.1.1...v1.2.0="">`__ (2016-09-16)
-------------------------------------------------------------------------------------

Features
~~~~~~~~

- **PooledClusterRpcProxy**: add support for NAMEKO\_RPC\_TIMEOUT
setting
(`d4d6042 <https: github.com="" clef="" flask-nameko="" commit="" d4d6042="">`__)

`1.1.0 <https: github.com="" clef="" flask-nameko="" compare="" v1.0.1...v1.1.0="">`__ (2016-08-09)
-------------------------------------------------------------------------------------

Features
~~~~~~~~

- **FlaskPooledClusterRpcProxy**: add lazy\_load\_services config
(`26184f6 <https: github.com="" clef="" flask-nameko="" commit="" 26184f6="">`__)

`0.1.0 <https: github.com="" clef="" flask-nameko="" compare="" 89698bba0ece0781f931b006009d3b3468e7883a...v0.1.0="">`__ (2016-07-28)
-----------------------------------------------------------------------------------------------------------------------

Features
~~~~~~~~

- **flask\_nameko**: adds FlaskPooledClusterRpcProxy
(`285df05 <https: github.com="" clef="" flask-nameko="" commit="" 285df05="">`__)

0.1.0
------------------

* First release on PyPI.
Release History

Release History

1.3.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
flask_nameko-1.3.0.tar.gz (7.1 kB) Copy SHA256 Checksum SHA256 Source Sep 20, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting