Dear xqt, is it ok?
# -*- coding: utf-8 -*- import wikipedia site=wikipedia.getSite('fa', fam='wikipedia') listofarticles=[u"عماد خراسانی",u"کوری جهاز"] for name in listofarticles: page=wikipedia.Page(site,name) data=wikipedia.DataPage(page) try: items=data.get() except wikipedia.NoPage: print "The item doesn't exist. Creating..." data.createitem("Bot: Importing article from Persian wikipedia") else: print "It has been created already. Skipping..." I tested it, it was ok. but I'm not sure
On Tue, Feb 26, 2013 at 11:49 AM, info@gno.de wrote:
Hi folks,
Reza1615 as published a small code snippet to create items at data repository. Please use this sample with care becaus it does not test whether a data repository item already exists. It only test whether it exists for a given site page. This could also mean that a given site page as no language link on a given repository page. This must be checked before a page is created.
Regards xqt
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l