Skip to main content

A Flask wrapper to easily handle routes defined as Python native objects

Project description

A wrapper for Flask’s native routing as a form of template. Routes will be defined as objects to easily define domains.

# Inside some route object
from froi import Froi
class SomeRoute(Froi):
    def __init__(self, app):
        super().__init__(app, 'SomeRoute', '/some_route')

    def install(self):
        # define a get route on base
        self.setget().route(view_func=sample_fxn_1)

        # define a post
        self.setpost().route('/do_something', view_func=sample_fxn_2)

        # define a put
        self.setput().route('/edit_something', view_func=sample_fxn_3)

        # define a delete
        self.setdelete().route('/delete_something', view_func=sample_fxn_4)

# Inside your server handler
from flask import Flask
from some_route import SomeRoute
app = Flask(config.APP_NAME)
SomeRoute(app).install()
app.run()

If you want a RESTful pattern to handle the routes, you can omit defining the install function.

from froi import Froi
class SomeRoute(Froi):
    def __init__(self, app):
        super().__init__(app, 'SomeRoute', '/some_route')

    def get(self):
        ... do something

    def post(self):
        ... do something

This will automatically create the defined GET, POST, PUT, and DELETE endpoints.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

froi-0.2.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

froi-0.2.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file froi-0.2.2.tar.gz.

File metadata

  • Download URL: froi-0.2.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/2.7.15rc1 Linux/4.15.0-47-generic

File hashes

Hashes for froi-0.2.2.tar.gz
Algorithm Hash digest
SHA256 74b52e01f46b36fe160f8a43ef5f387c9f98452ee39351a74d8e9e3a64e0197e
MD5 b61497ca4050d309774660ff79e5c144
BLAKE2b-256 1759c3067461ccf8f0b0a644d80192e9eeeec2d3cf104f8e7ef187fb6e454d5d

See more details on using hashes here.

File details

Details for the file froi-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: froi-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.11 CPython/2.7.15rc1 Linux/4.15.0-47-generic

File hashes

Hashes for froi-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b1c0ed9627876f3af8e3288ea7d28cfc6edf8cdb1962f8dc3417a6a6197c39b2
MD5 8ccbf320effae83ce6a5cfea716e8391
BLAKE2b-256 2e2866c75aa4ee42a9aa13543b954438298a5461d84e1c1764b3a7288f31a7b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page