Skip to main content

This is a recreation of the popular python package, Flask.

Project description

finnsflask

This is a recreation of the popular python package, Flask.

Usage

The base

For a project with no endpoints import the module then create a instance with:

app = finnsflask.FinnsFlask()

Then start the app with:

if __name__ == "__main__":
    app.listen()

Endpoints

To declare an endpoint, between your app declaration and when you start the app, put:

@app.route('/<path>')
def index(request: finnsflask.HTTPRequest):
    return finnsflask.HTTPResponse("<h1>Real Finnventor is awesome</h1>", 200)

Templates

finnsflask uses jinja2 as a templating system. To use a jinja2 template, use a route declaration like the following:

@app.route("/<path>")
def index(request: finnsflask.HTTPRequest):
    return finnsflask.HTTPResponse.load_template('<path-to-jinja2-template>', <template-args>)

Cookies

To get a cookie, use the following inside of your route declaration:

cookies = request.getCookies()

To set a cookie, use a route declaration like the following:

@app.route("/<path>")
def index(request: finnsflask.HTTPRequest):
    response = finnsflask.HTTPResponse()
    response.setCookie("<key>", "<value>")
    return response

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

finnsflask-1.2-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file finnsflask-1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: finnsflask-1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for finnsflask-1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ff1d2b37a5f4283dfd95299863b3c92090d4fae23d90ba673a8301c521b13781
MD5 dd604b771d378d196005854d6ce30a41
BLAKE2b-256 6a4cd97dc127f7a84212724ee5d438fdbd2e8fac66474c9112f807aac83374f1

See more details on using hashes here.

Supported by

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