Skip to main content

A simple module for searching on DuckDuckGo

Project description

DuckPy
A simple Python module that searches on DuckDuckGo.

Installation:

Duckpy can be installed using pip from PyPI or from GitHub

via PyPI using pip:

pip install -U duckpy

via GitHub using pip+git:

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

Usage:

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

First example (normal version):

import duckpy

client = duckpy.Client()

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

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

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

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

The result:

GitHub - AmanoTeam/duckpy: A simple Python module that ...
https://github.com/AmanoTeam/duckpy
A simple Python module that searches on DuckDuckGo - AmanoTeam/duckpy

First example (asyncio version):

import asyncio
import duckpy.aio

client = duckpy.aio.Client()

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

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

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

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


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

The result:

GitHub - AmanoTeam/duckpy: A simple Python module that ...
https://github.com/AmanoTeam/duckpy
A simple Python module that searches 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 on 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://123.45.67.89: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.0.0.tar.gz (2.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: duckpy-2.0.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for duckpy-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f0a41f914d8eb9c0b99c4bdf34ba171303ff6e2b4cbe60b12c3c4a37e0f4c700
MD5 e538469bbeac80df6c5cbbc9a76f9b33
BLAKE2b-256 56ef43f909e83b98e0d55a59190e0809f7054e48563c2a82923cd97bdf4a3ece

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