Skip to content

Commit cc44734

Browse files
committed
Update readme to reflect RelatedTopics structure
1 parent 49b64e3 commit cc44734

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

README.rst

+16-13
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,34 @@ Usage
2424
>>> import duckduckgo
2525
>>> r = duckduckgo.query('DuckDuckGo')
2626
>>> r.type
27-
'answer'
27+
u'answer'
2828
>>> r.results[0].text
29-
'Official site'
29+
u'Official site'
3030
>>> r.results[0].url
31-
'http://duckduckgo.com/'
31+
u'http://duckduckgo.com/'
3232
>>> r.abstract.url
33-
'http://en.wikipedia.org/wiki/Duck_Duck_Go'
33+
u'http://en.wikipedia.org/wiki/Duck_Duck_Go'
3434
>>> r.abstract.source
35-
'Wikipedia'
35+
u'Wikipedia'
3636

3737
>>> r = duckduckgo.query('Python')
3838
>>> r.type
39-
'disambiguation'
40-
>>> r.related[6].text
41-
'Python (programming language), a computer programming language'
42-
>>> r.related[6].url
43-
'http://duckduckgo.com/Python_(programming_language)'
39+
u'disambiguation'
40+
>>> r.related[1].text
41+
u'Python (programming language), a computer programming language'
42+
>>> r.related[1].url
43+
u'http://duckduckgo.com/Python_(programming_language)'
44+
>>> r.related[7].topics[0].text # weird, but this is how the DDG API is currently organized
45+
u'Armstrong Siddeley Python, an early turboprop engine'
46+
4447

4548
>>> r = duckduckgo.query('1 + 1')
4649
>>> r.type
47-
'nothing'
50+
u'nothing'
4851
>>> r.answer.text
49-
'1 + 1 = 2'
52+
u'1 + 1 = 2'
5053
>>> r.answer.type
51-
'calc'
54+
u'calc'
5255

5356
>>> print duckduckgo.query('19301', kad='es_ES').answer.text
5457
19301 es un código postal de Paoli, PA

0 commit comments

Comments
 (0)