ignore forbidden errors

some Carrefour pages return forbidden for a few products

2024-07-06T11:32:47.059230Z ERROR scraper::scraper: error=HTTP status client error (403 Forbidden) for url (https://www.carrefour.com.ar/apple-macbook-pro-14--m1-pro-chip-10%E2%80%91core-cpu-16%E2%80%91core-gpu---1tb-ssd---silver--1656560/p) url="https://www.carrefour.com.ar/apple-macbook-pro-14--m1-pro-chip-10‑core-cpu-16‑core-gpu---1tb-ssd---silver--1656560/p"
2024-07-06T11:33:07.881310Z ERROR scraper::scraper: error=HTTP status client error (403 Forbidden) for url (https://www.carrefour.com.ar/apple-macbook-pro-14--m1-pro-chip-10%E2%80%91core-cpu-16%E2%80%91core-gpu---1tb-ssd---space-grey-1657067/p) url="https://www.carrefour.com.ar/apple-macbook-pro-14--m1-pro-chip-10‑core-cpu-16‑core-gpu---1tb-ssd---space-grey-1657067/p"
2024-07-06T11:33:56.483980Z ERROR scraper::scraper: error=HTTP status client error (403 Forbidden) for url (https://www.carrefour.com.ar/apple-macbook-pro-16--m1-pro-chip-10%E2%80%91core-cpu-16%E2%80%91core-gpu---1tb-ssd---silver--1656993/p) url="https://www.carrefour.com.ar/apple-macbook-pro-16--m1-pro-chip-10‑core-cpu-16‑core-gpu---1tb-ssd---silver--1656993/p"
2024-07-06T11:34:16.992339Z ERROR scraper::scraper: error=HTTP status client error (403 Forbidden) for url (https://www.carrefour.com.ar/apple-macbook-pro-16--m1-pro-chip-10%E2%80%91core-cpu-16%E2%80%91core-gpu---1tb-ssd---space-grey-1656986/p) url="https://www.carrefour.com.ar/apple-macbook-pro-16--m1-pro-chip-10‑core-cpu-16‑core-gpu---1tb-ssd---space-grey-1656986/p"
2024-07-06T11:41:00.997947Z ERROR scraper::scraper: error=HTTP status client error (403 Forbidden) for url (https://www.carrefour.com.ar/leche-de-coco-coco-do-vale-reducida-en-calor%E2%88%9A-as-500-cc/p) url="https://www.carrefour.com.ar/leche-de-coco-coco-do-vale-reducida-en-calor√-as-500-cc/p"
This commit is contained in:
Cat /dev/Nulo 2024-07-06 08:46:04 -03:00
parent c4e11f05b6
commit 17c7e5701a

View file

@ -163,7 +163,8 @@ pub fn get_parse_retry_policy() -> again::RetryPolicy {
} }
pub fn retry_if_wasnt_not_found(err: &reqwest::Error) -> bool { pub fn retry_if_wasnt_not_found(err: &reqwest::Error) -> bool {
!err.status().is_some_and(|s| s == StatusCode::NOT_FOUND) !err.status()
.is_some_and(|s| s == StatusCode::NOT_FOUND || s == StatusCode::FORBIDDEN)
} }
pub fn anyhow_retry_if_wasnt_not_found(err: &anyhow::Error) -> bool { pub fn anyhow_retry_if_wasnt_not_found(err: &anyhow::Error) -> bool {
match err.downcast_ref::<reqwest::Error>() { match err.downcast_ref::<reqwest::Error>() {