[WikimediaSE-L] no api?
Erik Hjalmar Josefsson
erik.hjalmar.josefsson at gmail.com
Sat May 1 17:40:53 UTC 2010
Hello,
Stef (in cc) is trying to script pages from europarl.europa.eu into a
wiki campaign site: act-on-acta.eu
For some reason the only text written ends up at the root page /api.php,
see:
http://en.act-on-acta.eu/index.php?title=Api.php&diff=prev&oldid=187
The training target is one page (per language) at
http://en.act-on-acta.eu/Sandbox/HerrNilssons6rdTry
Here is the code using wikitools
from password import USER,PASSWORD
# wikitools approach
import wikitools
site = wikitools.wiki.Wiki("http://en.act-on-acta.eu/api.php")
site.login(USER, password=PASSWORD)
page = wikitools.Page(site,title='Sandbox/HerrNilssons6rdTry')
page.edit(text="=== hello world ===\nHerr Nilsson gets very annoyed")
And here the code using mwclient
from password import USER,PASSWORD
# mwclient approach
import mwclient
site = mwclient.Site("en.act-on-acta.eu")
site.login(USER, PASSWORD)
# Edit page
page = site.Pages['Sandbox/HerrNilssons6rdTry']
#text = page.edit()
#print 'Text in sandbox:', text.encode('utf-8')
#page.save(text + u'\nExtra data', summary = 'Test edit')
page.save("=== hello world ===\nHerr Nilsson gets very annoyed")
Anyone has some helpful tips?
//Erik
More information about the WikimediaSE-L
mailing list