Skip to content

Commit

Permalink
V3.9.5 (#132)
Browse files Browse the repository at this point in the history
1) BUGFIX in images() function: add "Accept" parameter to requests,
2) update requirements to use httpx 0.25.1 version (Add support for Python 3.12).
  • Loading branch information
deedy5 authored Nov 10, 2023
1 parent 01e5d63 commit 16d56a6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion duckduckgo_search/duckduckgo_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(self, headers=None, proxies=None, timeout=10) -> None:
if headers is None:
headers = {
"User-Agent": choice(USERAGENTS),
"Accept": "application/json, text/javascript, */*; q=0.01",
"Referer": "https://duckduckgo.com/",
}
self._client = httpx.Client(headers=headers, proxies=proxies, timeout=timeout, http2=True)
Expand Down Expand Up @@ -361,7 +362,6 @@ def images(
payload = {
"l": region,
"o": "json",
"s": 0,
"q": keywords,
"vqd": vqd,
"f": f"{timelimit},{size},{color},{type_image},{layout},{license_image}",
Expand Down
2 changes: 1 addition & 1 deletion duckduckgo_search/duckduckgo_search_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(self, headers=None, proxies=None, timeout=10) -> None:
if headers is None:
headers = {
"User-Agent": choice(USERAGENTS),
"Accept": "application/json, text/javascript, */*; q=0.01",
"Referer": "https://duckduckgo.com/",
}
self._client = httpx.AsyncClient(headers=headers, proxies=proxies, timeout=timeout, http2=True)
Expand Down Expand Up @@ -363,7 +364,6 @@ async def images(
payload = {
"l": region,
"o": "json",
"s": 0,
"q": keywords,
"vqd": vqd,
"f": f"{timelimit},{size},{color},{type_image},{layout},{license_image}",
Expand Down
2 changes: 1 addition & 1 deletion duckduckgo_search/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.9.4"
__version__ = "3.9.5"
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies = [
"aiofiles>=23.2.1",
"click>=8.1.7",
"lxml>=4.9.3",
"httpx[http2,socks,brotli]>=0.25.0",
"httpx[http2,socks,brotli]>=0.25.1",
]
dynamic = ["version"]

Expand All @@ -45,7 +45,7 @@ ddgs = "duckduckgo_search.cli:cli"
version = {attr = "duckduckgo_search.version.__version__"}

[project.optional-dependencies]
dev = [
dev = [
"black>=23.9.1",
"isort>=5.12.0",
"ruff>=0.0.291",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiofiles>=23.2.1
click>=8.1.7
lxml>=4.9.3
httpx[http2,socks,brotli]>=0.25.0
httpx[http2,socks,brotli]>=0.25.1

0 comments on commit 16d56a6

Please sign in to comment.