elm.web.search.duckduckgo.APIDuckDuckGoSearch
- class APIDuckDuckGoSearch(api_key=None)[source]
Bases:
APISearchEngineLinkSearch
Search the web for links using the DuckDuckGo API
- Parameters:
api_key (str, optional) – API key for search engine. If
None
, will look up the API key using theAPI_KEY_VAR
environment variable. By default,None
.
Methods
results
(*queries[, num_results])Retrieve links for the first num_results of each query
Attributes
Name of environment variable that should contain the API key
- API_KEY_VAR = None
Name of environment variable that should contain the API key
- async results(*queries, num_results=10)
Retrieve links for the first num_results of each query
This function executes a search for each input query and returns a list of links corresponding to the top num_results.
- Parameters:
*queries (str) – One or more queries to search for.
num_results (int, optional) – Number of top results to retrieve for each query. Note that this value can never exceed the number of results per page (typically 10). If you pass in a larger value, it will be reduced to the number of results per page. By default,
10
.
- Returns:
list – List equal to the length of the input queries, where each entry is another list containing the top num_results links.