Created
March 11, 2016 07:00
-
-
Save timothycrosley/0bc7d313e7a84b708374 to your computer and use it in GitHub Desktop.
A simple example of a hug API call with versioning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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)) | |
def echo(text): | |
return 'Echo: {text}'.format(**locals()) | |
@hug.get('/unversioned') | |
def hello(): | |
return 'Hello world!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment