Skip to main content

A simple module for searching on DuckDuckGo

Project description

DuckPy
A simple Python module for searching on DuckDuckGo.

Installation

Duckpy can be installed using pip with this command:

pip install -U duckpy

Alternatively, you can install directly from git:

pip install -U git+https://github.com/AmanoTeam/duckpy

Usage:

To use duckpy is easy, let's see some examples:

First example:

from duckpy import Client

client = Client()

results = client.search("Amano Team duckpy")

# Prints first result title
print(results[0]["title"])

# Prints first result URL
print(results[0]["url"])

# Prints first result description
print(results[0]["description"])

We also provide an asynchronous version:

import asyncio
from duckpy.aio import Client

client = Client()

async def get_results():
  results = await client.search("Amano Team duckpy")

  # Prints first result title
  print(results[0]["title"])

  # Prints first result URL
  print(results[0]["url"])

  # Prints first result description
  print(results[0]["description"])


loop = asyncio.get_event_loop()
loop.run_until_complete(get_results())

The result:

GitHub - AmanoTeam/duckpy: 🦆 A simple Python module for ...
https://github.com/AmanoTeam/duckpy
🦆 A simple Python module for searching on DuckDuckGo - AmanoTeam/duckpy

Advanced usage:

You can also set up proxies and/or enable or disable random User-Agents depending on your needs.

Setting up proxies:

You can pass a list with proxies in the Client object, then duckpy will use these proxies to make requests.

Example:

import duckpy

client = duckpy.Client(proxies=['http://123.45.67.89:80', 'https://98.76.54.32:443'])

If you pass more than one proxy, them will be randomly chosen every time you use the .search() method.

Project details


Download files

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

Files for duckpy, version 2.1.0
Filename, size File type Python version Upload date Hashes
Filename, size duckpy-2.1.0-py2.py3-none-any.whl (3.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size duckpy-2.1.0.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page