Discasto added a comment.

Hi all, I've successfully posted TabularData through pywikibot following your code :-) However, I haven't used "contentmodel" (as such contentmodel is not supported) but only "contentformat" (set to "application/json"). That is, simply overwriting the save() method with

kwargs['contentformat'] = 'application/json'

And using json.dumps with ensure_ascii set to False has been enough for writing (see here)

And yes, there should be a new class called TabularDataPage (same for maps). However, I'm far from being a Python expert and feel as if my code is possibly not suitable to be included in a professional package as Pywikibot (moreover, I find TabularData a quite inconvenient format given that I mostly work with pandas, which does not directly support this format). On the other hand, I haven't investigated yet how to read TabularData and possibly is not that simple (however, I guess that something similar is currently being done with wikidata Items, as they're also modeled as json structures, and therefore shouldn't be impossible).

To sum up, I'm trying to write some nice code to write and read TabularData and will be glad to contribute it to Pywikibot. However, I'm unsure about how to do it. Any guidance



To: Discasto
Cc: Yurik, Mpaa, Aklapper, pywikibot-bugs-list, Discasto, Magul, Tbscho, rafidaslam, MayS, Mdupont, JJMC89, debt, Reasno, Avicennasis, Base, jayvdb, zhuyifei1999, Dalba, Masti, Alchimista, Rxy, Jay8g
pywikibot-bugs mailing list

Reply via email to