Requests logging middleware
Requests logging middleware logs all requests being made and received responses.
Configuration of the plugin is defined in RequestsLoggingPluginConfig.
How to configure plugin for the SneakpeekServer (will be used globally for all requests):
from sneakpeek.plugins.requests_logging_plugin import RequestsLoggingPlugin, RequestsLoggingPluginConfig
server = SneakpeekServer.create(
...
plugins=[
RequestsLoggingPlugin(
RequestsLoggingPluginConfig(
log_request=True,
log_response=True,
)
)
],
)
How to override plugin settings for a given scraper:
from sneakpeek.plugins.requests_logging_plugin import RequestsLoggingPluginConfig
scraper = Scraper(
...
config=ScraperConfig(
...
plugins={
"requests_logging": RequestsLoggingPluginConfig(
log_request=True,
log_response=False,
)
}
),
)