Last active
January 20, 2018 09:42
-
-
Save CykuTW/b68dfd71fc08d56df008f76baf8b0fd3 to your computer and use it in GitHub Desktop.
Revisions
-
CykuTW revised this gist
Jan 20, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,8 +10,10 @@ class Teapot(MethodView): def brew(self): abort(418) app.add_url_rule('/', view_func=Teapot.as_view(Teapot.__name__)) if __name__ == '__main__': """ example: -
CykuTW renamed this gist
Jan 20, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
CykuTW revised this gist
Jan 20, 2018 . No changes.There are no files selected for viewing
-
CykuTW created this gist
Jan 20, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ from flask import Flask, abort from flask.views import MethodView app = Flask(__name__) class Teapot(MethodView): methods = ['BREW'] def brew(self): abort(418) app.add_url_rule('/', view_func=Teapot.as_view(Teapot.__name__)) if __name__ == '__main__': """ example: > curl -X BREW 'http://127.0.0.1:5000/' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>418 I'm a teapot</title> <h1>I'm a teapot</h1> <p>This server is a teapot, not a coffee machine</p> """ app.run()