https://bugzilla.wikimedia.org/show_bug.cgi?id=55149
Web browser: --- Bug ID: 55149 Summary: setitem for wikidata doesn't work! Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1587/ Reported by: reza1615 Created on: 2013-02-24 19:21:13 Subject: setitem for wikidata doesn't work! Original description: I used this code
#!/usr/bin/python # -*- coding: utf-8 -*- import wikipedia,login summary=u'آبشار لاتون,آبشار لاتون'
site=wikipedia.getSite('fa',fam='wikipedia') fapage=wikipedia.Page(site,u'آبشار_لاتون') data=wikipedia.DataPage(fapage)
list=data.get() id=list['entity'].replace('q','') data = wikipedia.DataPage(site.data_repository(), "Q"+id)
data.setitem(summary,items={'type': u'item', 'label': 'glk', 'value':u'آبشار_لاتون'}) data.setitem(summary,items={'type': u'sitelink', 'site': 'glk', 'title':u'آبشار_لاتون_(بارزاو)'})
it shows Updating page [[wikidata:Q5058182]] via API Updating page [[wikidata:Q5058182]] via API
but it doesn't update the page! also please add
def getIdFromPage(data) id=data.get() ['entity'].replace('q','') return id
and add
data = DataPage(site.data_repository(), "Q"+id)
to first line of setitem()