Scrapy middleware with TOR support for more robust scrapers or anonymous scraping.
Project description
scrapy-tor-downloader
Scrapy middleware with TOR support for more robust scrapers or anonymous scraping.
Dependencies :globe_with_meridians:
Installation :inbox_tray:
This is a python package hosted on pypi, so to install simply run the following command:
pip install scrapy-tor-downloader
Settings
TOR_PROXY_ENABLED
Whether TOR is used to proxy any request (defaults to false).
Meta field to enable/disable this per request is: tor_proxy_enabled
TOR_FALLBACK_ENABLED
Whether TOR is used when a request fails as a fallback (defaults to true).
Meta field to enable/disable this per request is: tor_fallback_enabled
Usage example :eyes:
In order to use this plugin simply add the following settings and substitute your variables:
DOWNLOADER_MIDDLEWARES = {
"tormiddleware.middleware.TORDownloaderMiddleware": 631
}
This will immediately allow you begin using TOR as a fallback when one of your requests fail. In order to use it as a proxy you can add the following to your settings:
TOR_PROXY_ENABLED = True
This will make every request hit TOR for a response. If you have turned the proxy on the TOR fallback is ignored, however if it is off the fallback is still on by default, which means if a request returns an error it will be tried again on TOR. In order to turn this off add the following to your settings:
TOR_FALLBACK_ENABLED = False
License :memo:
The project is available under the MIT License.
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
Hashes for scrapy-tor-downloader-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 168ee9e521206198cf5b07d4b2702c9a8246ec5ac41431e8133b2b6a56481c50 |
|
MD5 | 0934c520a995b61481896ab38e485991 |
|
BLAKE2b-256 | 985344655d7e0dac2addea2db7664b8dcea8c55d5b41243bbb9d5f114b0ab47a |