Skip to content

Instantly share code, notes, and snippets.

@timothycrosley
Created March 11, 2016 07:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timothycrosley/0bc7d313e7a84b708374 to your computer and use it in GitHub Desktop.
Save timothycrosley/0bc7d313e7a84b708374 to your computer and use it in GitHub Desktop.
A simple example of a hug API call with versioning
"""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