Falcon-Tryton
Adds Tryton support to Falcon application.
#! -*- coding: utf8 -*-
from functools import wraps
from falcon_tryton import Tryton
import falcon
import os
CONTEXT = None
CONFIG = {}
CONFIG['TRYTON_DATABASE'] = os.environ.get('DB_NAME', 'mydb')
CONFIG['TRYTON_USER'] = 0
app = falcon.App()
tryton = Tryton(app, CONFIG)
User = tryton.pool.get('res.user')
# @tryton.default_context
# def default_context():
# global CONTEXT
# if not CONTEXT:
# CONTEXT = User.get_preferences(context_only=True)
# return CONTEXT
class ApiUser:
@tryton.transaction()
def on_get(self, req, resp):
resp.status = falcon.HTTP_200
users = User.browse([1])
resp.media = {'name':users[0].name}
apiuser = ApiUser()
app.add_route("/user", apiuser)
# wsgi gunicorn o uwsgi:
""" example file wsgi_falcon.py:
from app_falcon import app
"""
# important: no use app.run()
There are three configuration options available:
TRYTON_DATABASE: the Tryton's database to connect.TRYTON_USER: the Tryton user id to use, by default0(akaroot).
Release files for falcon-tryton 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| falcon_tryton-0.1.3.tar.gz | 17.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| falcon_tryton-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / falcon_tryton-0.1.3.tar.gz
| Download URL | falcon_tryton-0.1.3.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a68a705536d5cdc15a86be6ab2d021ba6bd8f9cfa5b0810d4639ace78dd8c7a
|
|
BLAKE2b-256 checksum How to use checksums |
9fd98fce7b15c5f9ea5fd98bb23a704f3f334326ab12273f9a416bdff363a5b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / falcon_tryton-0.1.3-py3-none-any.whl
| Download URL | falcon_tryton-0.1.3-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a936cb0ae03b76ad054f79179c042db01ca398aceb8c520a144e29ac987eecd1
|
|
BLAKE2b-256 checksum How to use checksums |
174f72319f3959b1df99a51430f5299b9c847411f27e9a44db0035799f9fcf6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|