Skip to content

Commit

Permalink
utils.py: _is_500_in_url() - decorate with lru_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
deedy5 committed Mar 12, 2024
1 parent 013636a commit ebefde6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions duckduckgo_search/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import re
from decimal import Decimal
from functools import lru_cache
from html import unescape
from math import atan2, cos, radians, sin, sqrt
from typing import Any, Dict, List, Union
Expand Down Expand Up @@ -62,6 +63,7 @@ def _text_extract_json(html_bytes: bytes, keywords: str) -> List[Dict[str, str]]
raise DuckDuckGoSearchException(f"_text_extract_json() {keywords=} return None")


@lru_cache
def _is_500_in_url(url: str) -> bool:
"""Something like '506-00.js' inside the url."""
return bool(REGEX_500_IN_URL.search(url))
Expand Down

0 comments on commit ebefde6

Please sign in to comment.