Last active
March 15, 2016 01:37
-
-
Save timothycrosley/10e379958445e1f58d2d to your computer and use it in GitHub Desktop.
Expand first API to include HTTP support
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
"""First hug API (local and HTTP access)""" | |
import hug | |
@hug.get(examples='name=Timothy&age=26') | |
@hug.local() | |
def happy_birthday(name: hug.types.text, age: hug.types.number, hug_timer=3): | |
"""Says happy birthday to a user""" | |
return {'message': 'Happy {0} Birthday {1}!'.format(age, name), | |
'took': float(hug_timer)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment