All Projects → AmanoTeam → duckpy

AmanoTeam / duckpy

Licence: MIT license
A simple Python library for searching on DuckDuckGo.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to duckpy

asyncio-socks-server
A SOCKS proxy server implemented with the powerful python cooperative concurrency framework asyncio.
Stars: ✭ 154 (+670%)
Mutual labels:  asynchronous, pypi, asyncio
Purerpc
Asynchronous pure Python gRPC client and server implementation supporting asyncio, uvloop, curio and trio
Stars: ✭ 125 (+525%)
Mutual labels:  asynchronous, pypi, asyncio
Edgedb Python
EdgeDB Python Driver
Stars: ✭ 113 (+465%)
Mutual labels:  asynchronous, asyncio
Kubernetes asyncio
Python asynchronous client library for Kubernetes http://kubernetes.io/
Stars: ✭ 147 (+635%)
Mutual labels:  asynchronous, asyncio
Aiosmtplib
asyncio smtplib implementation
Stars: ✭ 200 (+900%)
Mutual labels:  asynchronous, asyncio
thanker
Don't be a wanker, be a thanker! Automatically give thanks to Pypi packages you use in your project.
Stars: ✭ 25 (+25%)
Mutual labels:  pypi, asyncio
Tornado Sqlalchemy
SQLAlchemy support for Tornado
Stars: ✭ 112 (+460%)
Mutual labels:  asynchronous, asyncio
Paco
Small utility library for coroutine-driven asynchronous generic programming in Python 3.4+
Stars: ✭ 198 (+890%)
Mutual labels:  asynchronous, asyncio
Vibe Core
Repository for the next generation of vibe.d's core package.
Stars: ✭ 56 (+180%)
Mutual labels:  asynchronous, asyncio
Senpai
💨Making communication📞easier and faster🚅for all 👦 + 👧 + 👴 + 👶 + 🐮 + 🐦 + 🐱
Stars: ✭ 43 (+115%)
Mutual labels:  module, pypi
Try
Dead simple CLI tool to try Python packages - It's never been easier! 📦
Stars: ✭ 588 (+2840%)
Mutual labels:  module, pypi
socketwrapper
Async/Sync networking library including UDP, TCP and TLS/TCP socket classes written in C++ 17.
Stars: ✭ 33 (+65%)
Mutual labels:  asynchronous, asyncio
Aiormq
Pure python AMQP 0.9.1 asynchronous client library
Stars: ✭ 112 (+460%)
Mutual labels:  asynchronous, asyncio
Backoff
Python library providing function decorators for configurable backoff and retry
Stars: ✭ 1,670 (+8250%)
Mutual labels:  asynchronous, asyncio
Peony Twitter
An asynchronous Twitter API client for Python 3.5+
Stars: ✭ 62 (+210%)
Mutual labels:  asynchronous, asyncio
Minotaur
A pythonic, asynchronous, inotify interface
Stars: ✭ 163 (+715%)
Mutual labels:  asynchronous, asyncio
aiotinydb
asyncio compatibility shim for tinydb
Stars: ✭ 42 (+110%)
Mutual labels:  pypi, asyncio
Halive
A fast http and https prober, to check which URLs are alive
Stars: ✭ 47 (+135%)
Mutual labels:  asynchronous, asyncio
Beanie
Micro ODM for MongoDB
Stars: ✭ 56 (+180%)
Mutual labels:  asynchronous, asyncio
Aiomisc
aiomisc - miscellaneous utils for asyncio
Stars: ✭ 200 (+900%)
Mutual labels:  asynchronous, asyncio

DuckPy

A simple Python module for searching on DuckDuckGo.

PyPI GitHub

Installation

Duckpy can be installed using pip with this command

pip install -U duckpy

Alternatively, you can install the most recent version from git

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

If you are using Debian or Ubuntu, you can install with this command (Currently only in Debian Unstable and Ubuntu 20.10+)

sudo apt install python3-duckpy

Usage

from duckpy import Client

client = Client()

results = client.search("Python Wikipedia")

# 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 inside the AsyncClient class

import asyncio
from duckpy import AsyncClient

client = AsyncClient()

async def get_results():
  results = await client.search("Python Wikipedia")

  # 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

Python (programming language) - Wikipedia
https://en.wikipedia.org/wiki/Python_(programming_language)
Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991...

Advanced usage

You can also set up proxies or set up custom User-Agent strings depending on your needs.

Setting up proxies

DuckDuckGo may temporarily block your request IP or return empty results, especially if you are using the library for scraping, bots and other stuff that generate many requests. This is not a duckpy issue and can be prevented using proxies.

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

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, they will be randomly chosen every time you use the .search() method.

Setting up custom User-Agents

import duckpy

user_agents = [
  "Mozilla/5.0 (X11; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0",
  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
]

client = duckpy.Client(default_user_agents=user_agents)

Again, if you pass more than one User-Agent, they will be randomly chosen every time you use the .search() method.

Disclaimer

We are not affiliated, associated, authorized, endorsed by, or in any way officially connected with DuckDuckGo, or any of its subsidiaries or its affiliates. The official DuckDuckGo website can be found at https://duckduckgo.com.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].