A simple and lightweight Python wrapper for DuckDuckGo search.
Project description
DuckDuckGoSearchApi
DuckDuckGoSearchApi is a Python library that provides a simple and direct interface for interacting with the DuckDuckGo API. This library is designed to simplify searches and the analysis of results from DuckDuckGo.
Instalation
To install run the following:
pip install duckduckgo_search_api
Available Methods
The Duckduckgo
class offers the following main methods:
search(query)
: Accepts a query string and returns search results ( ~ 20 results per input ~ )
Usage
Here's an example of how to use the DuckDuckGoSearchApi:
from ddg import Duckduckgo
ddg_api = Duckduckgo()
results = ddg_api.search("Google")
Success request
Search results are returned as a Python dictionary. Each result contains the page title, URL, and a description
{
"success": true,
"data": [
{
"title": "Page Title",
"url": "https://www.example.com",
"description": "Short description of the page"
},
]
}
Error request
In case of an error the returned object will contain the success
field set to false
{
"success": false,
"statusCode": 404,
"message": "Failed to fetch data"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for duckduckgo_search_api-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4e0336b5c9ca376a1ee21a5680a37a391ad3e0cec58fc2aebe7628646d9a16a |
|
MD5 | 23a8a520a69b2d7314fab889cead875a |
|
BLAKE2b-256 | a3b8bf1da7d45e7e556f1d5ba8d115758c1dd6693cf1d69d343ce8eaa5b55826 |
Close
Hashes for duckduckgo_search_api-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d08c59db31adc1ff68353339e618b100fdebf9ac7ffee987bf1960dfdca548a4 |
|
MD5 | 270a84d702de4fec331d6f12fce73c6b |
|
BLAKE2b-256 | 76c5f1956a1d81634632e1841e5b0298e5051e3edf3c751671eb639bca41d81e |