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.

Source Distribution

duckpy-2.1.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

duckpy-2.1.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file duckpy-2.1.1.tar.gz.

File metadata

  • Download URL: duckpy-2.1.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for duckpy-2.1.1.tar.gz
Algorithm Hash digest
SHA256 3a91622a12aca9bf11288f667b44bf8546e0963ed568c65ac5eb6e5fb92aa4d9
MD5 8a5244e6442b4ba2bb6773c383550ef6
BLAKE2b-256 6e32721cdbbe93e9181fe492c17a1002f3c20c79d016da5f2a580bc72bc8216a

See more details on using hashes here.

File details

Details for the file duckpy-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: duckpy-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for duckpy-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e91c0d6f1d42fefc6dcba38efe3e3189478ff0d556d2656900df7ba9a5f3d0a
MD5 679003298cec50dfebdc5a2752e8b08e
BLAKE2b-256 d3333f21d4fe317f044ab03ba8ee7b103be420134729f311cd37aa076127b46c

See more details on using hashes here.

Supported by

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