-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
111 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pkgutil | ||
from .base import BaseTester | ||
import inspect | ||
|
||
|
||
# load classes subclass of BaseCrawler | ||
classes = [] | ||
for loader, name, is_pkg in pkgutil.walk_packages(__path__): | ||
module = loader.find_module(name).load_module(name) | ||
for name, value in inspect.getmembers(module): | ||
globals()[name] = value | ||
if inspect.isclass(value) and issubclass(value, BaseTester) and value is not BaseTester \ | ||
and not getattr(value, 'ignore', False): | ||
classes.append(value) | ||
__all__ = __ALL__ = classes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from proxypool.setting import TEST_DONT_SET_MAX_SCORE, PROXY_SCORE_INIT, PROXY_SCORE_MAX, PROXY_SCORE_MIN | ||
|
||
|
||
class BaseTester(object): | ||
test_url = "" | ||
key = "" | ||
test_dont_set_max_score = TEST_DONT_SET_MAX_SCORE | ||
proxy_score_init = PROXY_SCORE_INIT | ||
proxy_score_max = PROXY_SCORE_MAX | ||
proxy_score_min = PROXY_SCORE_MIN | ||
|
||
def headers(self): | ||
return None | ||
|
||
def cookies(self): | ||
return None | ||
|
||
async def parse(self, html, url, proxy, expr='{"code":0'): | ||
return True if expr in html else False |