Skip to content

Commit 2e53e4c

Browse files
committed
no need for bad bots
1 parent 757a5ab commit 2e53e4c

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

lmfdb/app.py

-25
Original file line numberDiff line numberDiff line change
@@ -308,31 +308,6 @@ def netloc_redirect():
308308
return redirect(urlunparse(replaced), code=302)
309309

310310

311-
@cached_function
312-
def bad_bots_list():
313-
return [
314-
elt.lower()
315-
for elt in [
316-
"The Knowledge AI",
317-
"Wolfram",
318-
"petalbot",
319-
"Bytespider",
320-
"Sogou",
321-
"MJ12bot",
322-
"Amazonbot",
323-
"meta",
324-
"facebook",
325-
]
326-
]
327-
328-
329-
@app.before_request
330-
def badbot():
331-
ua = request.user_agent.string.lower()
332-
for elt in bad_bots_list():
333-
if elt in ua:
334-
return render_template("404.html", title='Too many requests'), 429
335-
336311

337312
def timestamp():
338313
return '[%s UTC]' % time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())

0 commit comments

Comments
 (0)