A few helpful classes for working with mediawiki data
Project description
wikiWrapper
About
wikiWrapper is a basic python module designed to make working with the mediawiki action API easier.
Usage
Just place wikiWrapper.py in your working directory and import it into your program. It will be available on PyPi soon.
Creating a search:
import wikiWrapper
query = wikiWrapper.SearchQuery("Penguin")
SearchQuery parameters:
def __init__(self, search_q, host="wikipedia", srnamespace=0, srlimit=10, sroffset=0, srqiprofile="classic", _format="json")
search_q
: This should be a string containing the search you are enacting. It is the only mandatory parameter
host
: This should be a string. It chooses which member of the WikiMedia foundation you wish to make the search to. The default value of this parameter is "wikipedia". Accepted values are ("wikipedia", "wikibooks", "wikidata")
srnamespace
: This should be an integer or a string. It chooses which namespace on the wikimedia pages you wish to execute your search on. For all namespaces, use "*"
. The default value of this parameter is 0
.
srlimit
: This should be an integer or a string. The amount of pages to return from a search. The default value of this parameter is 10
.
sroffset
: This should be an integer or a string. Shifts results forward by specified amount. The default value of this parameter is 0
srqiprofile
: This should be a string. Chooses the algorithm used by the MediaWiki API to find your search results. The default value of this parameter is "classic"
. Accepted values are ("classic", "classic_noboostlinks", "empty", "wsum_inclinks", "wsum_inclinks_pv", "popular_inclinks_pv", "popular_inclinks", "engine_autoselect")
_format
: The format you want your data back in. Default value is "json"
Methods
query.search()
:
Returns raw HTTP request from the wikipedia page.
query.content_summary()
:
Returns the content summary of the search_q parameter's wiki page.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wikiWrapper-0.0.1a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3564ba699d34511893f8d246aceeb61cad128db76ef9f87f982f614b2a30616e |
|
MD5 | 82365b9de287dcad577ecd33c4b58078 |
|
BLAKE2b-256 | 1436bab8e4693c911bf4f11cee2f1c421e8e8f8c11ff2930f8e4eb7dd92b1bb2 |