Skip to content

Commit 78ec918

Browse files
committed
Merge pull request #1 from mrshu/patch-1
Added meanings option
2 parents 3abd21c + f75d7de commit 78ec918

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

duckduckgo.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__version__ = 0.2
77

88

9-
def query(query, useragent='python-duckduckgo '+str(__version__), safesearch=True, html=False, **kwargs):
9+
def query(query, useragent='python-duckduckgo '+str(__version__), safesearch=True, html=False, meanings=True, **kwargs):
1010
"""
1111
Query DuckDuckGo, returning a Results object.
1212
@@ -24,17 +24,20 @@ def query(query, useragent='python-duckduckgo '+str(__version__), safesearch=Tru
2424
useragent: UserAgent to use while querying. Default: "python-duckduckgo %d" (str)
2525
safesearch: True for on, False for off. Default: True (bool)
2626
html: True to allow HTML in output. Default: False (bool)
27+
meanings: True to include disambiguations in results (bool)
2728
Any other keyword arguments are passed directly to DuckDuckGo as URL params.
2829
""" % __version__
2930

3031
safesearch = '1' if safesearch else '-1'
3132
html = '0' if html else '1'
33+
meanings = '0' if meanings else '1'
3234
params = {
3335
'q': query,
3436
'o': 'json',
3537
'kp': safesearch,
3638
'no_redirect': '1',
3739
'no_html': html,
40+
'd': meanings,
3841
}
3942
params.update(kwargs)
4043
encparams = urllib.urlencode(params)

0 commit comments

Comments
 (0)