Skip to content

Instantly share code, notes, and snippets.

Last active March 26, 2017 01:33
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kgriffs/90837585fa4aca475229 to your computer and use it in GitHub Desktop.
Falcon Web Framework (
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())
Copy link

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.

C:  4, 0: Trailing whitespace (trailing-whitespace)
C: 14, 0: Trailing whitespace (trailing-whitespace)
C:  1, 0: Missing module docstring (missing-docstring)
C:  5, 0: Missing class docstring (missing-docstring)
W:  6,21: Unused argument 'req' (unused-argument)
R:  6, 4: Method could be a function (no-self-use)
R:  5, 0: Too few public methods (1/2) (too-few-public-methods)
C: 15, 0: Invalid constant name "api" (invalid-name)
C:  3, 0: standard import "import json" comes before "import falcon" (wrong-import-order)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment