A simple module for searching on DuckDuckGo
Project description
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
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
duckpy-2.1.1-py3-none-any.whl
(3.3 kB
view hashes)