Mediawiki mwclient python client library has been fixed for SMW

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Mediawiki mwclient python client library has been fixed for SMW

mbenard
Dear all,

"mwclient is a Python framework to interface with the MediaWiki API."

https://github.com/mwclient


mwclient has a class (Client) and a method (ask) that can query a Semantic Mediawiki.


Here is a code snippet showing how you could query SMW with mwclient :

import mwclient

site = mwclient.Site(('http','mywikiurl'),'mywikipath')
site.login('myusername','mypassword')

query = "[[Category:my cat]]|[[Has name::a name]]|?Has myproperty"
for answer in site.ask(query):
    for title, data in answer.items()
        print(title)
        print(data)



Note that you'll have to fetch the current version on github, the one available on Pypi (used by pip) does not have yet the fixes to Client.ask() function.

 Salutations,
 
 Michel Bénard
 Urbaniste
----------------------------- Disclaimer ------------------------------
--- Ce message ainsi que les éventuelles pièces jointes constituent une
correspondance privée et confidentielle à l'attention exclusive du
destinataire désigné ci-dessus. Si vous n'êtes pas le destinataire du
présent message ou une personne susceptible de pouvoir le lui délivrer,
il vous est signifié que toute divulgation, distribution ou copie,
totale ou partielle, sur un quelconque support de cette transmission
est strictement interdite. Si vous avez recu ce message par erreur,
nous vous remercions d'en informer l'expéditeur par téléphone ou de lui
retourner le présent message, puis d'effacer immédiatement ce message
de votre systeme. Tout message électronique est susceptible
d'altération. Le "groupement des Mousquetaires" décline toute
responsabilité au titre de ce message s'il a été altéré, déformé ou
falsifié.---
--- This e-mail and any attachments is a confidential correspondence
intended only for use of the individual or entity named above. If you
are not the intended recipient or the agent responsible for delivering
the message to the intended recipient, you are hereby notified that any
disclosure, distribution or copying, either whole or partial, in any
medium of this communication is strictly prohibited. If you have
received this communication by mistake, please notify the sender by
phone or by replying this message, and then delete this message from
your system. E-mails are susceptible of alteration. The
"Mousquetaires' group" shall not therefore be liable for the message
if altered, changed or falsified.---
-----------------------------------------------------------------------

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: Mediawiki mwclient python client library has been fixed for SMW

mbenard
Well

mwclient 0.8.5 working with SMW has just been pubished on Pypi by the
owner,  and henceforth can be installed with pip

- https://pypi.python.org/pypi/mwclient/0.8.5

releases notes

https://github.com/mwclient/mwclient/releases/tag/v0.8.5



Cheers

Michel Bénard
Urbaniste




De :    [hidden email]
A :     [hidden email]
Date :  18/05/2017 05:48
Objet : [Semediawiki-user] Mediawiki mwclient python client library has
been fixed for SMW



Dear all,

"mwclient is a Python framework to interface with the MediaWiki API."

https://github.com/mwclient


mwclient has a class (Client) and a method (ask) that can query a Semantic
Mediawiki.


Here is a code snippet showing how you could query SMW with mwclient :

import mwclient

site = mwclient.Site(('http','mywikiurl'),'mywikipath')
site.login('myusername','mypassword')

query = "[[Category:my cat]]|[[Has name::a name]]|?Has myproperty"
for answer in site.ask(query):
    for title, data in answer.items()
        print(title)
        print(data)



Note that you'll have to fetch the current version on github, the one
available on Pypi (used by pip) does not have yet the fixes to
Client.ask() function.

 Salutations,
 
 Michel Bénard
 Urbaniste
----------------------------- Disclaimer ------------------------------
--- Ce message ainsi que les éventuelles pièces jointes constituent une
correspondance privée et confidentielle à l'attention exclusive du
destinataire désigné ci-dessus. Si vous n'êtes pas le destinataire du
présent message ou une personne susceptible de pouvoir le lui délivrer,
il vous est signifié que toute divulgation, distribution ou copie,
totale ou partielle, sur un quelconque support de cette transmission
est strictement interdite. Si vous avez recu ce message par erreur,
nous vous remercions d'en informer l'expéditeur par téléphone ou de lui
retourner le présent message, puis d'effacer immédiatement ce message
de votre systeme. Tout message électronique est susceptible
d'altération. Le "groupement des Mousquetaires" décline toute
responsabilité au titre de ce message s'il a été altéré, déformé ou
falsifié.---
--- This e-mail and any attachments is a confidential correspondence
intended only for use of the individual or entity named above. If you
are not the intended recipient or the agent responsible for delivering
the message to the intended recipient, you are hereby notified that any
disclosure, distribution or copying, either whole or partial, in any
medium of this communication is strictly prohibited. If you have
received this communication by mistake, please notify the sender by
phone or by replying this message, and then delete this message from
your system. E-mails are susceptible of alteration. The
"Mousquetaires' group" shall not therefore be liable for the message
if altered, changed or falsified.---
-----------------------------------------------------------------------

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user