Just took a quick glance but I believe you need to set the following in the
family file for the wikibase site.
```
def interface(self, code):
return 'DataSite'
```
After this you should be able to use
```
repo = pywikibot.Site("fr", "wikidatacrbc")
item = pywikibot.ItemPage(repo, "Q3")
```
Cheers,
André / Lokal_Profil
On 21 Feb 2017 14:22, "Jean-Baptiste Pressac" <Jean-Baptiste.Pressac@univ-
brest.fr> wrote:
> Hello,
>
> To retrieve data from http://localhost/wikidata/index.php/Item:Q3 I
> understood I should better do:
>
> site = pywikibot.Site()
> repo = site.data_repository()
> item = pywikibot.ItemPage(repo, "Q3")
>
> However, the repo variable returns None. From where does data_repository()
> gets the data repository ?
>
> user-config.py is as follows:
>
> # -*- coding: utf-8 -*-
>
> mylang = 'fr'
> family = 'wikidatacrbc'
> usernames['wikidatacrbc']['fr'] = u'xxxxx'
> console_encoding = 'utf-8'
>
> and my family file (wikidatacrbc_family.py) is as follows
>
> # -*- coding: utf-8 -*-
> """
> This family file was auto-generated by $Id: xxxxxxxx $
> Configuration parameters:
> url = http://localhost/wikidata/
> name = wikidatacrbc
>
> Please do not commit this to the Git repository!
> """
>
> from pywikibot import family
> from pywikibot.tools import deprecated
>
>
> class Family(family.Family):
> def __init__(self):
> family.Family.__init__(self)
> self.name = 'wikidatacrbc'
> self.langs = {
> 'fr': 'localhost',
> }
>
> def scriptpath(self, code):
> return {
> 'fr': '/wikidata',
> }[code]
>
> @deprecated('APISite.version()')
> def version(self, code):
> return {
> 'fr': u'1.28.0',
> }[code]
>
> def protocol(self, code):
> return {
> 'fr': u'http',
> }[code]
>
> Thanks,
>
> Jean-Baptiste Pressac
>
> Traitement et analyse de bases de données
> Production et diffusion de corpus numériques
>
> Centre de Recherche Bretonne et Celtique
> Unité mixte de service (UMS) 3554
> 20 rue Duquesne
> CS 93837
> 29238 Brest cedex 3
>
> tel : +33 (0)2 98 01 68 95 <+33%202%2098%2001%2068%2095>
> fax : +33 (0)2 98 01 63 93 <+33%202%2098%2001%2063%2093>
>
> Le 21/02/2017 à 11:42, Jean-Baptiste Pressac a écrit :
>
> Hello,
> I installed Mediawiki 1.28 + Wikibase on Debian for testing purposes. I
> also downloaded Pywikibot 2.0rc5 and followed :
> https://www.mediawiki.org/wiki/Manual:Pywikibot/Third-party_
> Wiki_Quick_Start.
>
> I edited my first item on http://localhost/wikidata/index.php/Item:Q3
> which has "Théodore Hersart de la Villemarqué" as English and French label.
> I also made some statements about this item. However, I have got a
> pywikibot exception as I try to retrieve data from this item:
>
> "python pwb.py login" works fine.
>
> I entered the pwb.py shell: "python pwb.py shell" and typed the following:
>
> >>> site = pywikibot.Site()
> >>> site
> APISite("fr", "wikidatacrbc")
> >>> page = pywikibot.Page(site, u"Théodore Hersart de la Villemarqué")
> >>> item = pywikibot.ItemPage.fromPage(page)
> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> File "/home/jean-baptiste/git/core/pywikibot/page.py", line 3979, in
> fromPage
> % page.site)
> pywikibot.exceptions.WikiBaseError: wikidatacrbc:fr has no transcluded
> data
>
> Do you have any idea of the causes of this error ? What should be the name
> of the page in my case ?
>
> Thanks,
>
>
>
> _______________________________________________
> pywikibot mailing
> [email protected]https://lists.wikimedia.org/mailman/listinfo/pywikibot
>
>
>
> _______________________________________________
> pywikibot mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/pywikibot
>
>
_______________________________________________
pywikibot mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot