In past versions of pywikibot I was able to do this:
import pywikibot enwp = pywikibot.Site('en', 'wikipedia') repo = enwp.data_repository() enwp_page = pywikibot.Page(enwp, 'South Pole Telescope') content = enwp_page.get() wd_item = pywikibot.ItemPage.fromPage(enwp_page) item_dict = wd_item.get() print(item_dict['sitelinks']['commonswiki'].replace('South','Test'))
which would return
Category:Test Pole Telescope
With the current version of pywikibot, however, I get this:
Traceback (most recent call last): File "test.py", line 10, in <module> print(item_dict['sitelinks']['commonswiki'].replace('South','Test')) AttributeError: 'SiteLink' object has no attribute 'replace'
Something has clearly changed, is this documented somewhere, and is there a new method to get the string of the sitelinks, please?