A Scrapy extension that report your log from your scraped data.
Project description
Scrapy Log Report Extension
A Scrapy extension that report your log from your scraped data.
Usage
This Scrapy extension provides a way to report your log from your scraped data. It will generate a report every LOGSTATS_INTERVAL seconds, and send it to your log server.
# log report demo
{
"items_add": 0,
"pages_add": 0,
"items_rate": 0,
"pages_rate": 0,
"items_count": 0,
"pages_count": 0,
"spider_name": "douban",
"log_count/INFO": 8,
"log_count/DEBUG": 1,
"log_count/WARNING": 2,
"item_scraped_add_count": 0,
"response_received_add_count": 0
}
Installation
First, pip install this package:
$ pip install masterai-scrapy-extensions
Usage
Enable the extension in your project's settings.py file, by adding the following lines:
EXTENSIONS = {
"masterai_scrapy_extensions.logreport.ReportStats": 100,
}
#
LOGSTATS_INTERVAL = 60
# set the URL to your log server
# method POST is used to send the report data
LOGREPORT_URL = "http://127.0.0.1:5000/api/v1/task/worker/status"
That's all! Now run your job and have a look at the field stats.
Settings
The settings below can be defined as any other Scrapy settings, as described on Scrapy docs.
LOGREPORT_URL: set the interval in seconds to generate the report.LOGSTATS_INTERVAL: set the URL to your log server,method POST is used to send the report data.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file masterai_scrapy_extensions-2024.7.1.tar.gz.
File metadata
- Download URL: masterai_scrapy_extensions-2024.7.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81c745edebe12badee56ec5e657a9e0977fd1358e5600a0d5fcc7bae5d38f364
|
|
| MD5 |
ce0380fca15cad72f5b941a920790f57
|
|
| BLAKE2b-256 |
6dbef82aa11ed7aaf9a8b9ed2e48d8e3f1117bbc0c9702460e208bea6630ab73
|
File details
Details for the file masterai_scrapy_extensions-2024.7.1-py3-none-any.whl.
File metadata
- Download URL: masterai_scrapy_extensions-2024.7.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48f5fb63ed15880a231207f5d45dd62b10d97e9514989c6f594d8498d81814fe
|
|
| MD5 |
3777a699c06a370bf4d72541df042a1c
|
|
| BLAKE2b-256 |
2854f5f87174fe34d8a0101b004f8aa801c22cd36e836323c93e41b8db4d15a1
|