kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Fetching - Make an obvious error when using BrowserSteps with the simple text fetcher (#2145)
rodzic
593660e2f6
commit
e9a9790cb0
|
@ -61,6 +61,10 @@ class PageUnloadable(Exception):
|
||||||
self.message = message
|
self.message = message
|
||||||
return
|
return
|
||||||
|
|
||||||
|
class BrowserStepsInUnsupportedFetcher(Exception):
|
||||||
|
def __init__(self, url):
|
||||||
|
self.url = url
|
||||||
|
return
|
||||||
|
|
||||||
class EmptyReply(Exception):
|
class EmptyReply(Exception):
|
||||||
def __init__(self, status_code, url, screenshot=None):
|
def __init__(self, status_code, url, screenshot=None):
|
||||||
|
@ -712,6 +716,9 @@ class html_requests(Fetcher):
|
||||||
current_include_filters=None,
|
current_include_filters=None,
|
||||||
is_binary=False):
|
is_binary=False):
|
||||||
|
|
||||||
|
if self.browser_steps_get_valid_steps():
|
||||||
|
raise BrowserStepsInUnsupportedFetcher(url=url)
|
||||||
|
|
||||||
# Make requests use a more modern looking user-agent
|
# Make requests use a more modern looking user-agent
|
||||||
if not {k.lower(): v for k, v in request_headers.items()}.get('user-agent', None):
|
if not {k.lower(): v for k, v in request_headers.items()}.get('user-agent', None):
|
||||||
request_headers['User-Agent'] = os.getenv("DEFAULT_SETTINGS_HEADERS_USERAGENT",
|
request_headers['User-Agent'] = os.getenv("DEFAULT_SETTINGS_HEADERS_USERAGENT",
|
||||||
|
|
|
@ -430,6 +430,12 @@ class update_worker(threading.Thread):
|
||||||
'last_check_status': e.status_code,
|
'last_check_status': e.status_code,
|
||||||
'has_ldjson_price_data': None})
|
'has_ldjson_price_data': None})
|
||||||
process_changedetection_results = False
|
process_changedetection_results = False
|
||||||
|
except content_fetcher.BrowserStepsInUnsupportedFetcher as e:
|
||||||
|
err_text = "This watch has Browser Steps configured and so it cannot run with the 'Basic fast Plaintext/HTTP Client', either remove the Browser Steps or select a Chrome fetcher."
|
||||||
|
self.datastore.update_watch(uuid=uuid, update_obj={'last_error': err_text})
|
||||||
|
process_changedetection_results = False
|
||||||
|
logger.error(f"Exception (BrowserStepsInUnsupportedFetcher) reached processing watch UUID: {uuid}")
|
||||||
|
|
||||||
except UnableToExtractRestockData as e:
|
except UnableToExtractRestockData as e:
|
||||||
# Usually when fetcher.instock_data returns empty
|
# Usually when fetcher.instock_data returns empty
|
||||||
logger.error(f"Exception (UnableToExtractRestockData) reached processing watch UUID: {uuid}")
|
logger.error(f"Exception (UnableToExtractRestockData) reached processing watch UUID: {uuid}")
|
||||||
|
|
Ładowanie…
Reference in New Issue