File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
archive_query_log/captures Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 1
1
from itertools import chain
2
2
from typing import Iterable , Iterator
3
- from urllib .error import HTTPError
4
3
from urllib .parse import urljoin
5
4
from uuid import uuid5
6
5
from warnings import warn
9
8
from elasticsearch_dsl import Search
10
9
from elasticsearch_dsl .function import RandomScore
11
10
from elasticsearch_dsl .query import FunctionScore , RankFeature , Term
12
- from requests import ConnectTimeout
11
+ from requests import ConnectTimeout , HTTPError , Response
13
12
from tqdm .auto import tqdm
14
13
from web_archive_api .cdx import CdxApi , CdxMatchType
15
14
@@ -105,14 +104,14 @@ def _add_captures_actions(
105
104
return
106
105
except HTTPError as e :
107
106
ignored = False
108
- if e . status is not None :
109
- if e . status == 403 :
110
- warn (RuntimeWarning (
111
- f"Unauthorized to fetch captures for source "
112
- f"domain { source .provider .domain } and "
113
- f"URL prefix { source .provider .url_path_prefix } ."
114
- ))
115
- ignored = True
107
+ response : Response = e . response
108
+ if response . status_code == 403 :
109
+ warn (RuntimeWarning (
110
+ f"Unauthorized to fetch captures for source "
111
+ f"domain { source .provider .domain } and "
112
+ f"URL prefix { source .provider .url_path_prefix } ."
113
+ ))
114
+ ignored = True
116
115
if not ignored :
117
116
raise e
118
117
You can’t perform that action at this time.
0 commit comments