IP filtered DNS Resolver
Project description
os-scrapy-ipfilter-resolver
This project provide a DNS Resolver for ip blacklist/whitelist and config DNS expire time.
Install
pip install os-scrapy-ipfilter-resolver
You can run example spider directly in the project root path.
scrapy crawl example
Usage
Settings
-
enable DNS Resolver, in the project settings.py file:
DNS_RESOLVER = "os_scrapy_ipfilter_resolver.Resolver"
-
config IP blacklist, it will raise
IPFilteredException
when the request ip in the blacklistIP_DISALLOWED = ["192.168.0.0/16", "10.143.0.1"]
-
config IP whitelist, priority greater than blacklist
IP_ALLOWED = ["192.168.0.1"]
-
config DNS cache size and expire time(seconds)
DNSCACHE_ENABLED = True DNSCACHE_SIZE = 10000 DNSCACHE_EXPIRE = 24 * 60 * 60
-
config DNS lookup timeout(seconds)
DNS_TIMEOUT = 60
Unit Tests
tox
License
MIT licensed.
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
File details
Details for the file os_scrapy_ipfilter_resolver-0.0.4.tar.gz
.
File metadata
- Download URL: os_scrapy_ipfilter_resolver-0.0.4.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12aee9487d6548087557752499c8bf571953f5b67674e203a5c101295645dc67 |
|
MD5 | 8e85ca36edbb70a2924acfd648502e29 |
|
BLAKE2b-256 | aa6875e555b7aa3926ee0ec8d9f42dbbac89362e5e511c4d472c09637dc10673 |