Skip to content

Commit

Permalink
feat(Base): 增加跳过不在线检测
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhilip committed Sep 25, 2019
1 parent 78ece09 commit 5e14726
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions extractors/base/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ def __init__(self, status: bool, cookies: dict or str, **kwargs):
1. _EXTEND_DESCR_* : default True, Enable to Enhanced the description of the reseed torrent,
And its priority is higher than setting.extend_descr_raw[key]["status"].
2. _ASSIST_ONLY : default False, Enable to only assist the exist same torrent but not to reseed.
3. _ASSIST_DELAY_TIME : default 0, Delay reseed check time
4. _PASS_ONLINE_CHECK : default false, Pass the online check
"""
self._EXTEND_DESCR_BEFORE = kwargs.setdefault("extend_descr_before", True)
self._EXTEND_DESCR_THUMBNAILS = kwargs.setdefault("extend_descr_thumbnails", True)
self._EXTEND_DESCR_MEDIAINFO = kwargs.setdefault("extend_descr_mediainfo", True)
self._EXTEND_DESCR_CLONEINFO = kwargs.setdefault("extend_descr_cloneinfo", True)
self._ASSIST_ONLY = kwargs.setdefault("assist_only", False)
self._ASSIST_DELAY_TIME = kwargs.setdefault("assist_delay_time", 0)
self._PASS_ONLINE_CHECK = kwargs.setdefault('pass_online_check', False)

# Check Site Online Status
if self.status:
Expand All @@ -67,6 +70,9 @@ def online_check(self) -> bool:
:return: bool , True if online
"""
if self._PASS_ONLINE_CHECK:
return True

try:
requests.get(self.url_host, timeout=setting.REQUESTS_TIMEOUT)
except OSError: # requests.exceptions.RequestException
Expand Down

0 comments on commit 5e14726

Please sign in to comment.