Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duckduckgo_search_api-0.1.3.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

duckduckgo_search_api-0.1.3-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page