Repository navigation
Expand file tree
/
Copy pathapp.py
More file actions
102 lines (92 loc) · 2.96 KB
/
Copy pathapp.py
File metadata and controls
102 lines (92 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from flask import Flask, render_template
from werkzeug.exceptions import HTTPException
import random
app = Flask(__name__)
errors = {
701: "Meh",
702: "Emacs",
703: "Explosion",
704: "Goto Fail",
705: "I wrote the code and missed the necessary validation by an oversight",
706: "Delete Your Account",
707: "Can't quit vi",
710: "PHP",
711: "Convenience Store",
712: "NoSQL",
718: "I am not a teapot",
719: "Haskell",
720: "Unpossible",
721: "Known Unknowns",
722: "Unknown Unknowns",
723: "Tricky",
724: "This line should be unreachable",
725: "It works on my machine",
726: "It's a feature, not a bug",
727: "32 bits is plenty",
728: "It works in my timezone",
730: "Fucking npm",
731: "Fucking Rubygems",
732: "Fucking Unic💩de",
733: "Fucking Deadlocks",
734: "Fucking Deferreds",
736: "Fucking Race Conditions",
735: "Fucking IE",
737: "FuckThreadsing",
738: "Fucking Exactly-once Delivery",
739: "Fucking Windows",
750: "Didn't bother to compile it",
753: "Syntax Error",
754: "Too many semi-colons",
755: "Not enough semi-colons",
756: "Insufficiently polite",
757: "Excessively polite",
759: 'Unexpected "T_PAAMAYIM_NEKUDOTAYIM"',
761: "Hungover",
762: "Stoned",
763: "Under-Caffeinated",
764: "Over-Caffeinated",
765: "Railscamp",
766: "Sober",
767: "Drunk",
768: "Accidentally Took Sleeping Pills Instead Of Migraine Pills During Crunch Week",
771: "Cached for too long",
772: "Not cached long enough",
773: "Not cached at all",
774: "Why was this cached?",
775: "Out of cash",
776: "Error on the Exception",
777: "Coincidence",
778: "Off By One Error",
779: "Off By Too Many To Count Error",
780: "Project owner not responding",
781: "Operations",
782: "QA",
783: "It was a customer request, honestly",
784: "Management, obviously",
785: "TPS Cover Sheet not attached",
786: "Try it now",
787: "Further Funding Required",
788: "Designer's final designs weren't",
789: "Not my department",
791: "The Internet shut down due to copyright restrictions",
792: "Climate change driven catastrophic weather event",
793: "Zombie Apocalypse",
794: "Someone let PG near a REPL",
795: "#heartbleed (see 705)",
796: "Some DNS fuckery idno",
797: "This is the last page of the Internet. Go back",
798: "I checked the db backups cupboard and the cupboard was bare",
799: "End of the world"
}
@app.route('/')
def index():
return error(random.choice(list(errors)))
def error_html(error_number):
return render_template('error.html', error_number=error_number, error_description=errors[error_number])
def error(error_code):
exception = HTTPException()
exception.description = errors[error_code]
exception.code = error_code
return exception
if __name__ == '__main__':
app.run(debug=True, port=5000)