Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Semantic Mediawiki Python Binding

Project Description

Sematic MediaWiki Python binding

This package depends on the mwclient 0.7 development version

To install (will install mwclient 0.7dev automatically)

pip install smw

Or install from github

pip install git+git://

Usage example

from smw.SemanticMediaWiki import SemanticMediaWiki

# change this to your wiki's config
config = {
    "host": "",
    "path": "/wiki/",
    "http_login": None,
    "http_pass": None,
    "wiki_login": None,
    "wiki_pass": None,

wiki = SemanticMediaWiki(

# or from a config file (json)
# default ~/.smwrc
# sample config
wiki = SemanticMediaWiki.from_config()

query = r"""
|format = json

res = wiki.get_data(query, format='json')
[query_result, query_path] = res
# process query results from SMW >= 1.8.0
items = query_result['results']
for page in items:
    print items[page]

page_name = 'Foo'

# get page metadata in RDF/XML
rdf = wiki.getRDF(page_name)

# get page metadata in JSON, simplified for human readability
json_data = wiki.getJSON(page_name)

# parse any wiki script
result = wiki.parse("'''Hello'''")

# get raw page
# this is useful when query is composed on Special:Ask
html = wiki.get('/wiki/Main_Page')
json_result = wiki.get('/wiki/index.php?title=Special:Ask&q=[[Category:People]]&p[format]=json')

# add semantic annotations
page =['SnowWhite']
old_content = page.edit()
new_content = old_content + "[[Category:Princess]][[friend of::Grumpy]]"
Release History

Release History

This version
History Node

History Node

History Node

History Node


History Node

History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
smw- (10.3 kB) Copy SHA256 Checksum SHA256 2.7 Egg Feb 13, 2014
smw- (6.5 kB) Copy SHA256 Checksum SHA256 Source Feb 13, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting