Hi, pywikibot experts,
I've read through this ticket( https://www.mail-archive.com/pywikibot@lists.wikimedia.org/msg00186.html) for creating a new property using site._simple_request(**argv) api call, I wonder how I can delete a property using a similar way?
for example code like this way: params = { 'action': 'delete', 'id': 'P10', 'summary': 'bot remove', 'token': site.tokens['delete'] }
req = site._simple_request(**params) results = req.submit() print (results)
I've searched the actions by wikimedia API: https://www.wikidata.org/w/api.php?action=help, It seems there's no action for delete property, any idea?
There’s no specific API for deleting a property, but the regular delete API https://www.mediawiki.org/wiki/API:Delete should work – probably pretty similar to your example code, but with title: 'Property:P10' rather than id: 'P10'.
Cheers, Lucas
On 12.12.19 08:16, mosha chen wrote:
Hi, pywikibot experts, I've read through this ticket(https://www.mail-archive.com/pywikibot@lists.wikimedia.org/msg00186.html) for creating a new property using site._simple_request(**argv) api call, I wonder how I can delete a property using a similar way? for example code like this way: params = { 'action': 'delete', 'id': 'P10', 'summary': 'bot remove', 'token': site.tokens['delete'] }
req = site._simple_request(**params) results = req.submit() print (results)
I've searched the actions by wikimedia API: https://www.wikidata.org/w/api.php?action=help,%C2%A0 It seems there's no action for delete property, any idea?
-- Regards, Mosha
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
Thanks, Lucas.
Your suggested method works, thanks again.
Lucas Werkmeister mail@lucaswerkmeister.de 于2019年12月14日周六 上午7:13写道:
There’s no specific API for deleting a property, but the regular delete API https://www.mediawiki.org/wiki/API:Delete should work – probably pretty similar to your example code, but with title: 'Property:P10' rather than id: 'P10'.
Cheers, Lucas On 12.12.19 08:16, mosha chen wrote:
Hi, pywikibot experts, I've read through this ticket( https://www.mail-archive.com/pywikibot@lists.wikimedia.org/msg00186.html) for creating a new property using site._simple_request(**argv) api call, I wonder how I can delete a property using a similar way? for example code like this way: params = { 'action': 'delete', 'id': 'P10', 'summary': 'bot remove', 'token': site.tokens['delete'] }
req = site._simple_request(**params) results = req.submit() print (results)
I've searched the actions by wikimedia API: https://www.wikidata.org/w/api.php?action=help, It seems there's no action for delete property, any idea?
-- Regards, Mosha
pywikibot mailing listpywikibot@lists.wikimedia.orghttps://lists.wikimedia.org/mailman/listinfo/pywikibot
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot