From 39000813a6456f66d0c594805f5c17c9ccca97b1 Mon Sep 17 00:00:00 2001 From: Nilesh Gupta Date: Sat, 29 Oct 2016 16:20:54 -0500 Subject: [PATCH 1/2] Updated README changed the usage part to make it more clear for users --- README.rst => README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) rename README.rst => README.md (70%) diff --git a/README.rst b/README.md similarity index 70% rename from README.rst rename to README.md index 690c1ac..a86a134 100644 --- a/README.rst +++ b/README.md @@ -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)' - +Searching for 1 + 1 : >>> r = duckduckgo.query('1 + 1') >>> r.type 'nothing' From 808a0c304e3cd5f8f307a60d5a9a02483f8839ad Mon Sep 17 00:00:00 2001 From: Nilesh Gupta Date: Sat, 29 Oct 2016 16:25:07 -0500 Subject: [PATCH 2/2] Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a86a134..48e2a5d 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,13 @@ To install run Usage ===== -First we want to import the duckduckgo API + >>> # First we want to import the duckduckgo API >>> import duckduckgo -Then we are assigning 'r' to the search Duck Duck Go + >>> # 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: + >>> # 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 @@ -32,17 +32,17 @@ Since we are accessing the results part of the Duck Duck Go API, if we set the e 'http://en.wikipedia.org/wiki/Duck_Duck_Go' >>> r.abstract.source 'Wikipedia' -Now we are going to access the search Python + >>> # 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 + >>> #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 + >>> #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)' -Searching for 1 + 1 : + 'http://duckduckgo.com/Python_(programming_language)' + >>> #Searching for 1 + 1 : >>> r = duckduckgo.query('1 + 1') >>> r.type 'nothing'