mediawiki-utilities / python-mwapi

Simple Python Wrapper around MediaWiki API
http://pythonhosted.org/mwapi
MIT License
31 stars 11 forks source link

Semantic MediaWiki (SMW) results - (info) #33

Closed MvGulik closed 6 years ago

MvGulik commented 6 years ago

SMW API calls generally give the "results" part (JSON formatted wiki-api output) back as a JSON ordered object, ... which means python users lose the order of the resulting "result" dictionary.

One optional (local) way to potentially retrieve the data order of the "result" entries could be: 1) Adding a self.lastCall_textResult = None to the mwapi Session class. (optional) 2) Adding a self.lastCall_textResult = resp.text at the end of the Session _request() function.

This could give a way to retrieve the raw JSON result in text form of the last call, which could than be processed by some local function to return the elements order. (in its simplest form, depending on the resulted "result" data, on could extract the "result" string part. Split it up per entry. And collect the entry names in there intended order.)

(related to pre SMW 3.x versions ... if things work out.)