SuLab / WikidataIntegrator

A Wikidata Python module integrating the MediaWiki API and the Wikidata SPARQL endpoint
MIT License
244 stars 46 forks source link

Error when calling wdi_core.WDItemEngine.delete_items #116

Open cfellicious opened 4 years ago

cfellicious commented 4 years ago

When calling the "wdi_core.WDItemEngine.delete_items" function on our custom Wikibase(v1.32) the code crashes with the error message: "for x in requests.get(url=url, params=params, headers=headers).json()['query']['pages'].values()][ KeyError: 'pages'"

I ran this piece of code requests.get(url=url, params=params, headers=headers).json() and got this as the result {'batchcomplete': '', 'query': {'normalized': [{'from': 'Wikidata:Requests_for_deletions', 'to': 'wikidata:Requests for deletions'}], 'interwiki': [{'title': 'wikidata:Requests for deletions', 'iw': 'wikidata'}]}}

LeMyst commented 4 years ago

I confirm the issue.

andrawaag commented 4 years ago

This might require a redesign. This function is aimed at wikidata, where the functionality is a bit different than in wikibase. In the latter users can delete directly, whereas in Wikidata (at least from a user perspective) deletions are issued through requests for deletions.

I will investigate.

LeMyst commented 4 years ago

I created PR #131 to use the API action=delete.