File: force_https.py

package info (click to toggle)
python-hug 2.6.0-2.4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,072 kB
  • sloc: python: 8,938; sh: 99; makefile: 17
file content (13 lines) | stat: -rw-r--r-- 355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
"""An example of using a middleware to require HTTPS connections.
    requires https://github.com/falconry/falcon-require-https to be installed via
    pip install falcon-require-https
"""
import hug
from falcon_require_https import RequireHTTPS

hug.API(__name__).http.add_middleware(RequireHTTPS())


@hug.get()
def my_endpoint():
    return "Success!"