Skip to main content

Save statistics extension for Scrapy

Save statistics to mongo for analytics.

Install

The quick way:

pip install scrapy-save-statistics

Or install from GitHub:

pip install git+git://github.com/light4/scrapy-save-statistics.git@master

Or checkout the source and run:

python setup.py install

settings.py

Mongodb settings for save statistics, need a statistics database.

MONGO_HOST = "127.0.0.1"
MONGO_PORT = 27017
MONGO_DB = "myspider"
MONGO_STATISTICS = "statistics"

EXTENSIONS = {
    'scrapy_save_statistics.SaveStatistics': 100,
}

Spider

Spider must have statistics attributes and contains spider_url. We’ll save that info to mongodb.

class TestSpider(scrapy.Spider):
    name = "test"

    def __init__(self, name=None, **kwargs):
        super(TestSpider, self).__init__(name=name, **kwargs)
        self.statistics = []

    def parse(self, response):
        crawl_info = {'spider_url': spider_url,
                      'expected_crawl_num': expected_crawl_num,
                      'pages': total_page}
        self.statistics.append(crawl_info)

Metadata

Release files for scrapy-save-statistics 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for scrapy-save-statistics 0.2
File Interpreter ABI Platform Actions
scrapy_save_statistics-0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details for scrapy_save_statistics-0.2-py2.py3-none-any.whl

Release files / scrapy_save_statistics-0.2-py2.py3-none-any.whl

Download URL scrapy_save_statistics-0.2-py2.py3-none-any.whl
Size 4.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
aeb9743d06da179c480c5747cd086b1c19c5d0757295b72e950bc43c223f7e53
BLAKE2b-256 checksum
How to use checksums
c0ddd05e4c25af97e1bd384e1666b12d59e9a452f032b975e182a1dea6b67be2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for scrapy-save-statistics 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.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page