pywikibot has a cache of Site objects in the method pywikibot.Site. It uses a key of (family_name, site_code, username). If the site is a data repository, and first access of the site is via APISite.data_repository(), a DataSite object will be cached, and subsequent requests for an APISite will return a DataSite instead of an APISite.
DataSite is an APISite, but it has many methods marked as NotImplemented.
Steps to reproduce:
- Set the user-config.py default site to ar.wikipedia
- Instantiate a Wikidata client site object for ar.wikipedia
- Request the Wikidata repo object
- Instantiate a Wikidata repo site object for wikidata.wikidata
Expected results:
The object returned from step 4 will be an APISite
Actual results:
The object returned from step 4 will be a DataSite
$ python pwb.py shell
Welcome to the Pywikibot interactive shell!
import pywikibot
s = pywikibot.Site('ar', 'wikipedia')
ds = s.data_repository()
ds
DataSite("wikidata", "wikidata")
s2 = pywikibot.Site('wikidata', 'wikidata')
s2
DataSite("wikidata", "wikidata")
Version: core-(2.0)
Severity: major