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 ( ~ 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


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.5.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

duckduckgo_search_api-0.1.5-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file duckduckgo_search_api-0.1.5.tar.gz.

File metadata

  • Download URL: duckduckgo_search_api-0.1.5.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for duckduckgo_search_api-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e4e0336b5c9ca376a1ee21a5680a37a391ad3e0cec58fc2aebe7628646d9a16a
MD5 23a8a520a69b2d7314fab889cead875a
BLAKE2b-256 a3b8bf1da7d45e7e556f1d5ba8d115758c1dd6693cf1d69d343ce8eaa5b55826

See more details on using hashes here.

File details

Details for the file duckduckgo_search_api-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for duckduckgo_search_api-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d08c59db31adc1ff68353339e618b100fdebf9ac7ffee987bf1960dfdca548a4
MD5 270a84d702de4fec331d6f12fce73c6b
BLAKE2b-256 76c5f1956a1d81634632e1841e5b0298e5051e3edf3c751671eb639bca41d81e

See more details on using hashes here.

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