Spaces:
Runtime error
Runtime error
import wikipediaapi | |
class WikiClient: | |
def __init__(self): | |
self.wiki = wikipediaapi.Wikipedia( | |
user_agent="WikiAgent/0.0 [email protected]", | |
language="en", | |
extract_format=wikipediaapi.ExtractFormat.WIKI, | |
) | |
def get_pages(self, query): | |
pages = self.wiki.page(query) | |
return pages | |
if __name__ == "__main__": | |
client = WikiClient() | |
pages = client.get_pages("Cricket World Cup") | |
print(pages.summary) | |