Create a gist now

Instantly share code, notes, and snippets.

import json
def allowed_methods(request):
return ['HEAD', 'GET', 'PUT', 'DELETE', 'POST']
def content_types_provided(request):
return {'text/html': to_html, 'text/plain': to_text, 'application/json': to_json}
def is_authorized(request):
return True
def to_html(request):
return "<h1>Hello, World!</h1>"
def to_text(request):
return "Hello, World!"
def to_json(request):
return json.dumps({'message': "Hello, World!"})
from werkzeug.wrappers import Request, Response
def hello_world(request):
# 1. The allowed methods
if not request.method in allowed_methods():
raise Exception("Fuck")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment