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.
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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b92bdaae78b7469af77b660142e40477b7941477ff810b05cdad327e390814f6 |
|
MD5 | e722c36882e308d2170cfee87d0ae7dc |
|
BLAKE2b-256 | e7b1f94b8034bd14901fc4cec15dde3ae4f286eb6abce141354babc56d4da39d |
Close
Hashes for duckduckgo_search_api-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db42aa4bf82c5fd3041a23d817887067950bec0d61931450ae5774e3604b4ab8 |
|
MD5 | 7f27d5db0c3c0cf289cad73a4ee55f61 |
|
BLAKE2b-256 | d84f8a4ac6cffbf53094d307b7164c0e4c392d9be3379711319c26f2487a21b6 |