Wellverywell created this task.
Wellverywell added projects: Pywikibot, Commons.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
**Description**:
Assume I have `item` variable in Pywikibot being an instance of ItemPage
(Wikidata item) or MediaInfo (Commons structured data). I add labels/claims to
it via `item.claims.setdefault('P123', []).append(claim)` (in order not to make
hundreds of edits) and then run:
item.editEntity(summary='my edit')
This works perfectly for ItemPage. Though, it doesn't work for MediaInfo --
labels get added, but not claims.
The reason I believe is that when data is serialized to JSON in
WikibaseEntity.editEntity(), Commons API needs it to have the "claims" field --
not "statements" like Wikidata.
I currently use the following workaround for SDC:
data = item.toJSON(diffto=getattr(item, '_content', None))
data['claims'] = data['statements']
del data['statements']
commons.editEntity(item, data, summary='my edit')
TASK DETAIL
https://phabricator.wikimedia.org/T408432
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]