Skip to content

Commit

Permalink
quick and dirty HN-proofing
Browse files Browse the repository at this point in the history
  • Loading branch information
mazieres committed Jan 30, 2014
1 parent 3ec4a6f commit 1e164d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hello.py
Expand Up @@ -15,6 +15,8 @@
'blowjob,handjob,titjob,footjob' 'blowjob,handjob,titjob,footjob'
] ]


hn_proof = {}

This comment has been minimized.

Copy link
@rolorolo86

rolorolo86 Aug 12, 2014

run


def format_query(query): def format_query(query):
s = '' s = ''
for w in query.split(',')[:10]: for w in query.split(',')[:10]:
Expand Down Expand Up @@ -42,10 +44,13 @@ def get_data(query):
def index(): def index():
try: try:
q = format_query(request.args['q']) q = format_query(request.args['q'])
res = get_data(q)
except: except:
q = choice(examples) q = choice(examples)
if q not in hn_proof.keys():
hn_proof[q] = get_data(q)
res = hn_proof[q]


res = get_data(q)
return render_template('index', q=q, res=res) return render_template('index', q=q, res=res)


if __name__ == "__main__": if __name__ == "__main__":
Expand Down

0 comments on commit 1e164d5

Please sign in to comment.