Last modified: 2014-09-18 11:03:12 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1589/ Reported by: reza1615 Created on: 2013-02-27 10:18:28 Subject: update wikipdata's item one time! Original description: Now if we want add data below we should edit item 5 times\! it will crowded and messy the history \(imagine updating item with 60 interwikis\!\) lang:en >label:foo lang:de >label:foo lang:fa >label:foo labe:ru >label:foo lang:nl >;abel foo setitem should accept item in this style items=\[\{lang:en,label:foo\},\{lang:de,label:foo\},\{lang:fa,label:foo\},\{lang:ru,label:foo\},\{lang:nl,label:foo\}\] also for wikilinks and descriptions and aliases.
- **summary**: update wikipdata's items one time! --> update wikipdata's item one time!
http://wikidata.org/w/api.php API doesn't let changing of an existing item at once About creating it's possible
it lets \! http://www.wikidata.org/w/index.php?title=Q794445&diff=prev&oldid=7984899 done by api with \[\[mediawiki:gadget-slurpInterwiki.js\]\]
http://www.wikidata.org/w/index.php?title=Q794445&diff=7988999&oldid=7987394
I done this edit by wikidata.py library and it supports one edition for adding many labels and langs in a item updating but it's item creation has bug so now I should use wikipedia.py for create and wikidata.py for updating\! it is difficult because wikidata.py has it's own user\_confing.py and settings :\)
In wikipedia.py, I made createitem accept one more parameter which is a dictionary called 'value', and change variable params to params = \{ 'summary': self.\_encodeArg\(summary, 'summary'\), 'format': 'jsonfm', 'action': 'wbeditentity', 'data': re.sub\(ur"\bu\'", u'"', repr\(value\).decode\("unicode-escape"\)\).replace\("'", '"'\)\) \} With this code, you can call datapage.createitem\("Bot: import iw links", value=\{'labels': \{'en': \{'language': 'en', 'value': 'abc'\}, 'th': \{'language': 'th', 'value': 'bca'\}\}, 'sitelinks': \{'enwiki': \{'site': 'enwiki', 'title': 'abc'\}\}\}\)
thanks nu11zer0. we should also change wikipedia.py to accept more parameters for setitem\(\)
This was implemented in core: https://gerrit.wikimedia.org/r/#/c/125575/