Wikipedia API
This package provides python API for accessing Wikipedia.
Installation
pip3 install wikipedia-api
Usage
import wikipedia
wiki = wikipedia.Wikipedia('en')
page = wiki.article('Python_(programming_language)')
print("Page - Id: %s" % page.id())
# Page - Id: 23862
print("Page - Title: %s" % page.title())
# Page - Title: Python (programming language)
print("Page - Summary: %s" % page.summary())
# Page - Summary: Python is a widely used high-level programming ...
def print_sections(sections, level=0):
for s in sections:
print("%s: %s - %s" % ("*" * (level + 1), s.title(), s.text()[0:40]))
print_sections(s.sections(), level + 1)
print_sections(page.sections())
# *: History - Python was conceived in the late 1980s,
# *: Features and philosophy - Python is a multi-paradigm programming l
# *: Syntax and semantics - Python is meant to be an easily readable
# **: Indentation - Python uses whitespace indentation, rath
# **: Statements and control flow - Python's statements include (among other
# **: Expressions - Some Python expressions are similar to l
# ...
libraries = page.section_by_title('Libraries')
print("Section - Title: %s" % libraries.title())
# Section - Title: Libraries
print("Section - Text: %s" % libraries.text())
# Section - Text: Python's large standard library, commonly cited as ...
External Links
Changelog
0.1.4
It’s possible to extract summary and sections of the page
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Wikipedia-API-0.1.5.tar.gz
(5.0 kB
view details)
File details
Details for the file Wikipedia-API-0.1.5.tar.gz.
File metadata
- Download URL: Wikipedia-API-0.1.5.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c25e6f92519f49ad9be24df9cffacde60129ddc6513cd43e9e286594e69789dd
|
|
| MD5 |
627f0e07ea506dad01316d64fce8fe3c
|
|
| BLAKE2b-256 |
9c7790b0369db0555f17508337ede733fc1840c3bec624d7ce65bb37a9b9486e
|