Multichill created this task. Multichill added projects: Pywikibot-Wikidata, Pywikibot-Commons, StructuredDataOnCommons, Pywikibot. Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION Hitting T149410 <https://phabricator.wikimedia.org/T149410> again. I was trying to switch my code to use mediainfo.editEntity() instead of using site, but nothing happened. Some example code: import pywikibot site = pywikibot.Site('commons', 'commons') repo = site.data_repository() filepage = pywikibot.FilePage(site, 'File:-2011-03-05 Southern Hill Hospital, Mundesley, Norfolk (2).jpg') mediainfo = filepage.data_item() new_claim = pywikibot.Claim(repo, 'P7384') new_claim.setTarget('2295284') data = {'claims': [new_claim.toJSON(), ]} response = mediainfo.editEntity(data=data) print(response) (nothing happens) The problem is that the get API is returning 'statements' and the edit API expects 'claims'. In my dict I use claims. This hits WikibaseEntity._normalizeData which uses these fields: DATA_ATTRIBUTES = { 'labels': LanguageDict, 'statements': ClaimCollection, } Claims is not in there so the data dict is empty after normalization. I can't really think of a clean way to solve this at the moment. Maybe add ImageInfo._normalizeData() that doesn't mess it up? TASK DETAIL https://phabricator.wikimedia.org/T376955 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Multichill Cc: Aklapper, pywikibot-bugs-list, JJMC89, matej_suchanek, Xqt, Multichill, mevo, PotsdamLamb, Jyoo1011, FRomeo_WMF, JohnsonLee01, SHEKH, Dijkstra, Khutuck, Nintendofan885, Zkhalido, Aram, Viztor, JKSTNK, Wenyi, Tbscho, KimKelting, MayS, Mdupont, Dvorapa, Altostratus, Avicennasis, Fuzheado, mys_721tx, Daniel_Mietchen, jayvdb, Ricordisamoa, Lydia_Pintscher, Masti, Alchimista
_______________________________________________ pywikibot-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected]
