Skip to main content
PyPI Version Build Status Wheel Status Coverage report

Overview

Scrapy is a great framework for web crawling. This package provides a highly customized way to deal with the exceptions happening in the downloader middleware because of the proxy, and uses a signal to note relatives to treat the invalidated proxies (e.g. moving to blacklist, renew the proxy pool).

There are two types of signals this package support:

  • traditional signal, sync

  • deferred signal, async

Please refer to the scrapy and twisted documents:

Requirements

  • Scrapy

  • Tests on Python 3.5

  • Tests on Linux, but it is a pure python module, should work on any other platforms with official python and twisted support

Installation

The quick way:

pip install -U scrapy-proxy-validation

Or put this middleware just beside the scrapy project.

Documentation

Set this middleware in ITEMPIPELINES in settings.py, for example:

from scrapy_proxy_validation.downloadermiddlewares.proxy_validation import Validation

DOWNLOADER_MIDDLEWARES.update({
    'scrapy_proxy_validation.downloadmiddlewares.proxy_validation.ProxyValidation': 751
})

SIGNALS = [Validation(exception='twisted.internet.error.ConnectionRefusedError',
                      signal='scrapy.signals.spider_closed'),
           Validation(exception='twisted.internet.error.ConnectionLost',
                      signal='scrapy.signals.spider_closed',
                      signal_deferred='scrapy.signals.spider_closed',
                      limit=5)]

RECYCLE_REQUEST = 'scrapy_proxy_validation.utils.recycle_request.recycle_request'

Settings Reference

SIGNALS

A list of the class Validation with the exception it wants to deal with, the sync signal it sends, the async signal it sends and the limit it touches.

RECYCLE_REQUEST

A function to recycle the request which have trouble with the proxy, the input argument is request, and the output is request too.

Note: remember to set ``dont_filter`` to be ``True``, or the middleware ``duplicate_fitler`` will remove this request.

Built-in Functions

scrapy_proxy_validation.utils.recycle_request.recycle_request

This is a built-in function to recycle the request which has a problem with the proxy.

This function will remove the proxy keyword in meta and set dont_filter to be True.

To use this function, in settings.py:

RECYCLE_REQUEST = 'scrapy_proxy_validation.utils.recycle_request.recycle_request'

Note

There could be many different problems about the proxy, thus it will take some to collect them all and add to SIGNALS. Please be patient, this is not a once-time solution middleware for this case.

TODO

No idea, please let me know if you have!

Metadata

Release files for scrapy-proxy-validation 0.0.4

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

Source distribution (sdist)

Source distribution for scrapy-proxy-validation 0.0.4
File Size Uploaded Provenance Actions
scrapy-proxy-validation-0.0.4.tar.gz 21.9 kB Without provenance Details for scrapy-proxy-validation-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scrapy-proxy-validation 0.0.4
File Interpreter ABI Platform Actions
scrapy_proxy_validation-0.0.4-py3-none-any.whl Python 3 none any Details for scrapy_proxy_validation-0.0.4-py3-none-any.whl

Total release size: 30.5 kB

Release files / scrapy-proxy-validation-0.0.4.tar.gz

Download URL scrapy-proxy-validation-0.0.4.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3f6e3d72bf3458fd712b4693073ad4f98c4e4db567c705a9106f3c1053c4369f
BLAKE2b-256 checksum
How to use checksums
a39cdf6b9e97074b47405427ffc93e48746ec44e2004810a976fc695b60bcc07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / scrapy_proxy_validation-0.0.4-py3-none-any.whl

Download URL scrapy_proxy_validation-0.0.4-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ebc6c9882d5e3ca47cab4d78a504aed8ae80915af0715310c82baf0e426a589
BLAKE2b-256 checksum
How to use checksums
130ba436a8ea64215bf1b14ffc8c1b3097b01301e96011b78a9c33f136f2de72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for scrapy-proxy-validation 0.0.4

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.0.4 This release

2 release files 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