Skip to content

Commit

Permalink
Add logging to proxy validator
Browse files Browse the repository at this point in the history
  • Loading branch information
damklis committed Aug 3, 2020
1 parent 6b9673b commit d0ecedc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion airflow/modules/proxypool/proxypool_scraper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from bs4 import BeautifulSoup
from dataclasses import dataclass, field, asdict
from dataclasses import dataclass, field
from parser import WebParser


Expand Down
8 changes: 6 additions & 2 deletions airflow/modules/proxypool/proxypool_validator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from dataclasses import dataclass, asdict
from dataclasses import dataclass
from parser import WebParser
from log import log


@dataclass(frozen=True)
Expand All @@ -8,6 +9,7 @@ class ProxyStatus:
is_valid: bool


@log
class ProxyPoolValidator:
def __init__(self, url, timeout=10):
self.timeout = timeout
Expand All @@ -18,7 +20,9 @@ def validate_proxy(self, proxy_record):
timeout=self.timeout,
proxies=proxy_record.proxy
)
return ProxyStatus(
proxy_status = ProxyStatus(
proxy_record.proxy,
content is not None
)
self.logger.info(f"Proxy status: {proxy_status}")
return proxy_status

0 comments on commit d0ecedc

Please sign in to comment.