Scrapy SpiderStats Extension
将 Spider Stats 存储到 MongoDB 的扩展,可以用于爬虫监控和统计。
安装
pip install scrapy-spiderstats-extension
使用
在 settings.py 配置文件中开启 SpiderStats
EXTENSIONS = {
"scrapyspiderstats.SpiderStats": 0
}
STATS_MONGODB_URI = "mongodb://localhost:27017"
STATS_MONGODB_DB = "scrapy"
STATS_MONGODB_COL = "spiderstats"
存储结果
启动状态
{
"_id":"5fb23d9cbaf515d71d3a9c6c",
"log_count/INFO":9,
"start_time":"2020-11-16T08:51:40.705Z",
"stats_id":"2b55df7b46a548269ca603bb7ad889b2",
"spider_name":"test",
"pages":0,
"pagerate":0,
"items":0,
"itemrate":0,
"record_time":"2020-11-16T08:51:40.706Z"
}
记录状态
{
"_id":"5fb23dd8baf515d71d3a9c6d",
"log_count/INFO":12,
"start_time":"2020-11-16T08:51:40.705Z",
"stats_id":"2b55df7b46a548269ca603bb7ad889b2",
"spider_name":"test",
"pages":510,
"pagerate":510,
"items":0,
"itemrate":0,
"record_time":"2020-11-16T08:52:40.713Z",
"log_count/DEBUG":1034,
"scheduler/enqueued/redis":521,
"scheduler/dequeued/redis":520,
"downloader/request_count":520,
"downloader/request_method_count/GET":520,
"downloader/request_bytes":239235,
"downloader/response_count":510,
"downloader/response_status_count/200":510,
"downloader/response_bytes":110675,
"response_received_count":510,
"downloader/exception_count":3,
"downloader/exception_type_count/twisted-internet-error-TimeoutError":3,
"retry/count":3,
"retry/reason_count/twisted-internet-error-TimeoutError":3
}
完成状态
{
"_id":"5fb23e2ebaf515d71d3a9c6f",
"log_count/INFO":16,
"start_time":"2020-11-16T08:51:40.705Z",
"stats_id":"2b55df7b46a548269ca603bb7ad889b2",
"spider_name":"test",
"pages":1000,
"pagerate":6,
"items":0,
"itemrate":0,
"record_time":"2020-11-16T08:54:06.125Z",
"log_count/DEBUG":2015,
"scheduler/enqueued/redis":1007,
"scheduler/dequeued/redis":1007,
"downloader/request_count":1007,
"downloader/request_method_count/GET":1007,
"downloader/request_bytes":463763,
"downloader/response_count":1000,
"downloader/response_status_count/200":1000,
"downloader/response_bytes":216997,
"response_received_count":1000,
"downloader/exception_count":7,
"downloader/exception_type_count/twisted.internet.error.TimeoutError":7,
"retry/count":7,
"retry/reason_count/twisted.internet.error.TimeoutError":7,
"elapsed_time_seconds":145.420645,
"finish_time":"2020-11-16T08:54:06.125Z",
"finish_reason":"finished"
}
Metadata
Release files for scrapy-spiderstats-extension 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapy-spiderstats-extension-0.0.2.tar.gz | 4.5 kB | Without provenance | Details for scrapy-spiderstats-extension-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapy_spiderstats_extension-0.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for scrapy_spiderstats_extension-0.0.2-py2.py3-none-any.whl |
Total release size: 8.4 kB
Release files / scrapy-spiderstats-extension-0.0.2.tar.gz
| Download URL | scrapy-spiderstats-extension-0.0.2.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e274fa360ecaf7367c30669d6a6db399a0fd11ec201f6c77bc1d9fc6b691c20e
|
|
BLAKE2b-256 checksum How to use checksums |
2bd927e9d7eddcaae5d77af02834447f48c7684b86e077ee1419ce49d8e72935
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0
|
Release files / scrapy_spiderstats_extension-0.0.2-py2.py3-none-any.whl
| Download URL | scrapy_spiderstats_extension-0.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8230e3c41df447913ea67d73662163aaee1bcd4500e9237724006fd7ca219e6f
|
|
BLAKE2b-256 checksum How to use checksums |
051cf6bbf699258e7c09268382e6e33a86808492a60509afa4b4765c7a2cd7c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0
|
Security for scrapy-spiderstats-extension 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.