Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme updates #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.rst → README.md
Original file line number Diff line number Diff line change
@@ -17,11 +17,13 @@ To install run

Usage
=====

>>> # First we want to import the duckduckgo API
>>> import duckduckgo
>>> # Then we are assigning 'r' to the search Duck Duck Go
>>> r = duckduckgo.query('Duck Duck Go')
>>> r.type
'answer'
>>> # Since we are accessing the results part of the Duck Duck Go API, if we set the element to 0 we can see this:
>>> r.results[0].text
'Official site'
>>> r.results[0].url
@@ -30,15 +32,17 @@ Usage
'http://en.wikipedia.org/wiki/Duck_Duck_Go'
>>> r.abstract.source
'Wikipedia'

>>> # Now we are going to access the search Python
>>> r = duckduckgo.query('Python')
>>> #In the API, we are using teh disambiguation type, so this is what is returned
>>> r.type
'disambiguation'
>>> #Again, we can see the text involved in element 6 of the related API
>>> r.related[6].text
'Python (programming language), a computer programming language'
>>> r.related[6].url
'http://duckduckgo.com/Python_(programming_language)'

'http://duckduckgo.com/Python_(programming_language)'
>>> #Searching for 1 + 1 :
>>> r = duckduckgo.query('1 + 1')
>>> r.type
'nothing'