Rewrite FlareSolverr from scratch in Python + Selenium

This commit is contained in:
ngosang
2022-09-23 02:17:50 +02:00
parent 8d1ac09bf2
commit 1505595591
10 changed files with 929 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
from bottle import request, response
import logging
def logger_plugin(callback):
"""
Bottle plugin to use logging module
http://bottlepy.org/docs/dev/plugindev.html
Wrap a Bottle request so that a log line is emitted after it's handled.
(This decorator can be extended to take the desired logger as a param.)
"""
def wrapper(*args, **kwargs):
actual_response = callback(*args, **kwargs)
if not request.url.endswith("/health"):
logging.info('%s %s %s %s' % (request.remote_addr,
request.method,
request.url,
response.status))
return actual_response
return wrapper