X
X
xadezzz2021-04-19 19:09:52
Python
xadezzz, 2021-04-19 19:09:52

How not to save request history to .seleniumwire folder?

The problem is that the program is built on requests that are sent to the site every few seconds, and selenium creates a folder with requet and response for each request, which accumulates into several gigabytes in a short time, how to disable this logging?
(sorry if I described it clumsily, but I'm really a teapot)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
ScriptKiddo, 2021-04-19
@ScriptKiddo

1) Clone the repository https://github.com/wkeeling/selenium-wire
2) Replace timedelta with the desired value here
timedelta(days=REMOVE_DATA_OLDER_THAN_DAYS)
For example, for 10 minutes
timedelta(minutes=REMOVE_DATA_OLDER_THAN_MINUTES)
REMOVE_DATA_OLDER_THAN_MINUTES = 10 you need to create / rename in the same place where REMOVE_DATA_OLDER_THAN_DAYS was
3) Install via pip install ., while in the root directory of the repository
Done. When creating new driver instances, sessions older than the specified number of minutes will be automatically deleted

E
Evgeniy _, 2021-04-19
@GeneD88

You can try using the logging module

logging.basicConfig(level=logging.DEBUG) # для главного приложения будет запущено логгирование на уровне DEBUG.
logger = logging.getLogger('seleniumwire')
logger.setLevel(logging.CRITICAL)  # Собирает только critical для selenium wire

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question