|
8 | 8 | from multiprocessing import Lock |
9 | 9 | from pathlib import Path |
10 | 10 |
|
| 11 | +import requests # pylint: disable=colrev-search-source-requests-import |
11 | 12 | from pydantic import BaseModel |
12 | 13 | from pydantic import Field |
13 | 14 |
|
|
20 | 21 | import colrev.record.record_similarity |
21 | 22 | import colrev.search_file |
22 | 23 | import colrev.utils |
| 24 | +from colrev.constants import Colors |
23 | 25 | from colrev.constants import Fields |
24 | 26 | from colrev.constants import FieldValues |
25 | 27 | from colrev.constants import RecordState |
@@ -345,17 +347,22 @@ def search(self, rerun: bool) -> None: |
345 | 347 | logger=self.logger, |
346 | 348 | verbose_mode=self.verbose_mode, |
347 | 349 | ) |
348 | | - if self.search_source.search_type == SearchType.MD: |
349 | | - self._run_md_search(dblp_feed=dblp_feed) |
| 350 | + try: |
| 351 | + if self.search_source.search_type == SearchType.MD: |
| 352 | + self._run_md_search(dblp_feed=dblp_feed) |
350 | 353 |
|
351 | | - elif self.search_source.search_type in [ |
352 | | - SearchType.API, |
353 | | - SearchType.TOC, |
354 | | - ]: |
355 | | - self._run_api_search(dblp_feed=dblp_feed, rerun=rerun) |
| 354 | + elif self.search_source.search_type in [ |
| 355 | + SearchType.API, |
| 356 | + SearchType.TOC, |
| 357 | + ]: |
| 358 | + self._run_api_search(dblp_feed=dblp_feed, rerun=rerun) |
356 | 359 |
|
357 | | - else: |
358 | | - raise NotImplementedError |
| 360 | + else: |
| 361 | + raise NotImplementedError |
| 362 | + except requests.exceptions.ConnectTimeout: |
| 363 | + self.logger.warning( |
| 364 | + f"{Colors.RED}Skipping DBLP search (API currently not available){Colors.END}" |
| 365 | + ) |
359 | 366 |
|
360 | 367 | def load(self) -> dict: |
361 | 368 | """Load the records from the SearchSource file""" |
|
0 commit comments