File: versioning.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 (22 lines) | stat: -rw-r--r-- 382 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""A simple example of a hug API call with versioning"""
import hug


@hug.get("/echo", versions=1)
def echo(text):
    return text


@hug.get("/echo", versions=range(2, 5))  # noqa
def echo(text):
    return "Echo: {text}".format(**locals())


@hug.get("/unversioned")
def hello():
    return "Hello world!"


@hug.get("/echo", versions="6")
def echo(text):
    return "Version 6"