PageRenderTime 38ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/README.rst

http://github.com/mikejs/python-duckduckgo
ReStructuredText | 48 lines | 38 code | 10 blank | 0 comment | 0 complexity | 9b4ed1b0989d1d9c62ee88e3b281773e MD5 | raw file
Possible License(s): BSD-3-Clause
  1. ==================
  2. python-duckduckgo
  3. ==================
  4. A Python library for querying the Duck Duck Go API.
  5. Copyright Michael Stephens <me@mikej.st>, released under a BSD-style license.
  6. Source: http://github.com/mikejs/python-duckduckgo
  7. Installation
  8. ============
  9. To install run
  10. ``python setup.py install``
  11. Usage
  12. =====
  13. >>> import duckduckgo
  14. >>> r = duckduckgo.query('Duck Duck Go')
  15. >>> r.type
  16. 'answer'
  17. >>> r.results[0].text
  18. 'Official site'
  19. >>> r.results[0].url
  20. 'http://duckduckgo.com/'
  21. >>> r.abstract.url
  22. 'http://en.wikipedia.org/wiki/Duck_Duck_Go'
  23. >>> r.abstract.source
  24. 'Wikipedia'
  25. >>> r = duckduckgo.query('Python')
  26. >>> r.type
  27. 'disambiguation'
  28. >>> r.related[6].text
  29. 'Python (programming language), a computer programming language'
  30. >>> r.related[6].url
  31. 'http://duckduckgo.com/Python_(programming_language)'
  32. >>> r = duckduckgo.query('1 + 1')
  33. >>> r.type
  34. 'nothing'
  35. >>> r.answer.text
  36. '1 + 1 = 2'
  37. >>> r.answer.type
  38. 'calc'