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
Metadata
Release files for Wikipedia-API 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Wikipedia-API-0.1.5.tar.gz | 5.0 kB | Details |
Release files / Wikipedia-API-0.1.5.tar.gz
| Download URL | Wikipedia-API-0.1.5.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c25e6f92519f49ad9be24df9cffacde60129ddc6513cd43e9e286594e69789dd
|
|
BLAKE2b-256 checksum How to use checksums |
9c7790b0369db0555f17508337ede733fc1840c3bec624d7ce65bb37a9b9486e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |