Last modified: 2014-09-18 11:03:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57148, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55148 - update multiple data in Wikibase items at once
update multiple data in Wikibase items at once
Status: NEW
Product: Pywikibot
Classification: Unclassified
Wikidata (Other open bugs)
compat-(1.0)
All All
: Lowest enhancement
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:32 UTC by Kunal Mehta (Legoktm)
Modified: 2014-09-18 11:03 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:32:51 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.
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:32:53 UTC
- **summary**: update wikipdata's items one time! --> update wikipdata's item one time!
Comment 2 Kunal Mehta (Legoktm) 2013-10-05 04:32:55 UTC
http://wikidata.org/w/api.php
API doesn't let changing of an existing item at once 
About creating it's possible
Comment 3 Kunal Mehta (Legoktm) 2013-10-05 04:32:57 UTC
it lets \!
http://www.wikidata.org/w/index.php?title=Q794445&diff=prev&oldid=7984899
done by api with \[\[mediawiki:gadget-slurpInterwiki.js\]\]
Comment 5 Kunal Mehta (Legoktm) 2013-10-05 04:33:00 UTC
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 :\)
Comment 6 Kunal Mehta (Legoktm) 2013-10-05 04:33:02 UTC
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'\}\}\}\)
Comment 7 Kunal Mehta (Legoktm) 2013-10-05 04:33:04 UTC
thanks nu11zer0.
we should also change wikipedia.py to accept more parameters  for setitem\(\)
Comment 8 John Mark Vandenberg 2014-09-18 11:03:12 UTC
This was implemented in core:
https://gerrit.wikimedia.org/r/#/c/125575/

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links