Dear Wikibase experts,
I have a (hopefully) trivial question to ask: is there any specific configuration to set in order to make a wikibase extension accessible via libraries such as Pywikibot? Should I maybe activate the wikibase_client https://www.mediawiki.org/wiki/Extension:Wikibase_Client ?
Here's the problem described from the Pywikibot point of view: when I try to connect to my wikibase installation, I can access the mediawiki pages...
In [1]: import pywikibot In [2]: site = pywikibot.Site() In [9]: page = pywikibot.Page(site, u"Main_Page") In [10]: page.get() Out[10]: u"<strong>MediaWiki ha ........................
...but I cannot access the wikibase Items (created in the same mediawiki installation), since the "site.data_repository()" method (of my local Pywikibot site-object) returns an EMPTY value...
In [37]: site.data_repository() In [38]: type(site.data_repository()) Out[38]: NoneType
While, if I access (the same way) the wikibase instance of https://test.wikidata.org (of course) I get a correct response from the "site.data_repository()" method (of my local Pywikibot site-object):
In [39]: wikidatatest_site = pywikibot.Site("test", "wikidata") In [40]: wikidatatest_site.data_repository() Out[40]: DataSite("test", "wikidata") In [41]: type(wikidatatest_site.data_repository()) Out[41]: pywikibot.site.DataSite
Here are the main details of my mediawiki/wikibase installation: - MediaWiki: 1.26.2 - PHP: 5.6.15 (apache2handler) - MariaDB: 10.1.9-MariaDB - ICU: 4.8.1.1 ...with these extensions (with specific versions) for Wikibase: - Purtle: 0.1-dev - Wikibase DataModel: 4.4.0 - Wikibase DataModel JavaScript: 1.0.2-dev - Wikibase DataModel Serialization: 2.1.0 - Wikibase Internal Serialization: 2.1.0 - Wikibase JavaScript API: 1.1.0 - Wikibase Repository: 0.5 alpha (32d7ef0) 00:03, 30 September 2015 - Wikibase Serialization JavaScript: 2.0.6 - Wikibase View: 0.1-dev - WikibaseLib: 0.5 alpha (32d7ef0) 00:03, 30 September 2015
If this question is asked in the wrong context I'm really sorry (I searched with no success the official pages of Wikibase and the archive of this mailing-list, http://blog.gmane.org/gmane.org.wikimedia.wikidata.technical ): please let me know whether I should better ask this question to the Pywikibot library guys.
Thanks a lot for attention!
Hi,
I dont think we have tried running Pywikibot using a repository without the client also installed, however I do not believe that will be necessary.
I have added a section about Wikibase to the third-party wiki documentation
https://www.mediawiki.org/wiki/Manual:Pywikibot/Use_on_third-party_wikis#Wik...
On Wed, Mar 2, 2016 at 6:35 PM, comfortably numb comfortably.numb.349@gmail.com wrote:
Dear Wikibase experts,
I have a (hopefully) trivial question to ask: is there any specific configuration to set in order to make a wikibase extension accessible via libraries such as Pywikibot? Should I maybe activate the wikibase_client ?
Here's the problem described from the Pywikibot point of view: when I try to connect to my wikibase installation, I can access the mediawiki pages...
In [1]: import pywikibot In [2]: site = pywikibot.Site() In [9]: page = pywikibot.Page(site, u"Main_Page") In [10]: page.get() Out[10]: u"<strong>MediaWiki ha ........................
...but I cannot access the wikibase Items (created in the same mediawiki installation), since the "site.data_repository()" method (of my local Pywikibot site-object) returns an EMPTY value...
In [37]: site.data_repository() In [38]: type(site.data_repository()) Out[38]: NoneType
While, if I access (the same way) the wikibase instance of https://test.wikidata.org (of course) I get a correct response from the "site.data_repository()" method (of my local Pywikibot site-object):
In [39]: wikidatatest_site = pywikibot.Site("test", "wikidata") In [40]: wikidatatest_site.data_repository() Out[40]: DataSite("test", "wikidata") In [41]: type(wikidatatest_site.data_repository()) Out[41]: pywikibot.site.DataSite
Here are the main details of my mediawiki/wikibase installation:
- MediaWiki: 1.26.2
- PHP: 5.6.15 (apache2handler)
- MariaDB: 10.1.9-MariaDB
- ICU: 4.8.1.1
...with these extensions (with specific versions) for Wikibase:
- Purtle: 0.1-dev
- Wikibase DataModel: 4.4.0
- Wikibase DataModel JavaScript: 1.0.2-dev
- Wikibase DataModel Serialization: 2.1.0
- Wikibase Internal Serialization: 2.1.0
- Wikibase JavaScript API: 1.1.0
- Wikibase Repository: 0.5 alpha (32d7ef0) 00:03, 30 September 2015
- Wikibase Serialization JavaScript: 2.0.6
- Wikibase View: 0.1-dev
- WikibaseLib: 0.5 alpha (32d7ef0) 00:03, 30 September 2015
If this question is asked in the wrong context I'm really sorry (I searched with no success the official pages of Wikibase and the archive of this mailing-list, http://blog.gmane.org/gmane.org.wikimedia.wikidata.technical): please let me know whether I should better ask this question to the Pywikibot library guys.
Thanks a lot for attention!
Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
Hi,
Thanks a lot: your solution worked smoothly for me!
So it seems it was only a matter of Pywikibot library configuration:
I edited my family module, adding the 'shared_data_repository' method (similar to wikidata_family.py https://github.com/wikimedia/pywikibot- core/blob/2.0/pywikibot/families/wikidata_family.py#L32 ); and, for my specific use case, I also had to add the 'protocol' method (similar to osm_family.py https://github.com/wikimedia/pywikibot- core/blob/2.0/pywikibot/families/osm_family.py#L18 )
Cheers!
wikidata-tech@lists.wikimedia.org