Skip to content

Commit

Permalink
Remove orjson from dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
deedy5 committed Jul 5, 2024
1 parent 6f50af6 commit 9b42444
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions duckduckgo_search/utils.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import json
import re
from decimal import Decimal
from html import unescape
from math import atan2, cos, radians, sin, sqrt
from typing import Any, Dict, List, Union
from urllib.parse import unquote

import orjson

from .exceptions import DuckDuckGoSearchException

REGEX_STRIP_TAGS = re.compile("<.*?>")


def json_dumps(obj: Any) -> str:
try:
return orjson.dumps(obj).decode("utf-8")
return json.dumps(obj)
except Exception as ex:
raise DuckDuckGoSearchException(f"{type(ex).__name__}: {ex}") from ex


def json_loads(obj: Union[str, bytes]) -> Any:
try:
return orjson.loads(obj)
return json.loads(obj)
except Exception as ex:
raise DuckDuckGoSearchException(f"{type(ex).__name__}: {ex}") from ex

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ classifiers = [
dependencies = [
"click>=8.1.7",
"pyreqwest_impersonate>=0.4.9",
"orjson>=3.10.6",
]
dynamic = ["version"]

Expand Down

0 comments on commit 9b42444

Please sign in to comment.