Last active
March 26, 2017 01:33
-
-
Save kgriffs/90837585fa4aca475229 to your computer and use it in GitHub Desktop.
Falcon Web Framework (http://falconframework.org)
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
# sample.py | |
import falcon | |
import json | |
class QuoteResource: | |
def on_get(self, req, resp): | |
"""Handles GET requests""" | |
quote = { | |
'quote': 'I\'ve always been more interested in the future than in the past.', | |
'author': 'Grace Hopper' | |
} | |
resp.body = json.dumps(quote) | |
api = falcon.API() | |
api.add_route('/quote', QuoteResource()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm a bit of a stickler for pep8, and spotted a few issues. I went ahead and ran pylint over this example and will post output below. I would throw up a pr, but I dont think gists support that.