๐Ÿ’ป Back-End

DuckDuckGoSearchAPIWrapper.run HTTPError

์˜ฌใ„น1๋ธŒ 2025. 1. 26. 21:30
๋ฐ˜์‘ํ˜•

ํ˜„์ƒ

์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋ ค๋Š”๋ฐ ์ •ํ™•ํ•œ ๋ฉ”์„ธ์ง€๋Š” ์•ˆ ๋œจ๊ณ  ์ž๊พธ HTTPError๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค:

from langchain.utilities.duckduckgo_search import DuckDuckGoSearchAPIWrapper

def get_ticker(inputs):
    ddg = DuckDuckGoSearchAPIWrapper()
    company_name = inputs["company_name"]
    return ddg.run(f"symbol of {company_name}")

get_ticker({"name":"Google"})

 

์œ ์‚ฌํ•œ ์—๋Ÿฌ ์‚ฌํ•ญ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

duckduckgo_search.py in _get_url(self, method, url, **kwargs)
     80                 )
     81                 if self._is_500_in_url(str(resp.url)) or resp.status_code == 202:
---> 82                     raise httpx._exceptions.HTTPError("")
     83                 resp.raise_for_status()
     84                 if resp.status_code == 200:

HTTPError:

 

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

DuckDuckGo ํŒจํ‚ค์ง€(duckduckgo_search)๊ฐ€ ์„ค์น˜๋œ ๋ฒ„์ „์„ ํ™•์ธํ•˜์ž 3.8.5 ๋ฒ„์ „์ž„์„ ํ™•์ธํ–ˆ๋‹ค.
ํ•ด๋‹น ๋ฒ„์ „์„ ์ตœ์‹ ์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ๋ฅผ ํ•˜์ž ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์„ ํ™•์ธํ–ˆ๋‹ค.


# ํ˜„์žฌ ์„ค์น˜๋œ ๋ฒ„์ „ ํ™•์ธ ๋ฐฉ๋ฒ•
pip show duckduckgo_search

"""
Name: duckduckgo_search
Version: 3.8.3
Summary: Search for words, documents, images, news, maps and text translation using the DuckDuckGo.com search engine.
Home-page:
Author: deedy5
Author-email:
License: MIT License
Location: 
Requires: click, lxml, primp
Required-by:
"""

# ๋ฒ„์ „ ์—…๊ทธ๋ ˆ์ด๋“œ ๋ฐฉ๋ฒ•
pip install -U duckduckgo_search
๋ฐ˜์‘ํ˜•