How to search the Portuguese summary for the wikipedia API?

-2

How do I get the API to return the string in pt-br?

import wikipedia

pesquisa=wikipedia.summary(keyword)[0:150]
print(pesquisa)
    
asked by anonymous 12.07.2018 / 21:32

1 answer

2

If you are link set the language using:

wikipedia.set_lang("pt")

So:

import wikipedia

wikipedia.set_lang("pt") # Defina antes

pesquisa=wikipedia.summary(keyword)[0:150]
print(pesquisa)

See working at Repl.it

Note that Wikipedia only has pt , does not have pt-BR , ie wikipedia in Portuguese caters to Portugal and Brazil and probably other countries of the same language (of course I understand that there are variations, but within the articles themselves people try to adapt in the same texts)

    
12.07.2018 / 21:40