https://github.com/DamRsn/NeuralNote
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
from random import randint | |
from django.http import HttpResponse | |
class HTCPCPMiddleware(object): | |
""" | |
This middleware allows a your django project to act as a HTCPCP (Hyper | |
Text Coffee Pot Control Protocol) server. If the user requests to BREW | |
a coffee, and it is not on the list. Then it will get a `406 Not | |
Acceptable`, and randomly it will respond with `418 I'm a teapot`. | |