Pywikibot doesn't support the wmf interwiki prefix, but the prefix works on wiki and is in the interwikimap (/w/api.php?action=query&format=json&meta=siteinfo&siprop=interwikimap).
An exception shouldn't be raised when the Page object is created based on working links in wikitext (e.g. [[:wmf:Terms of Use|Terms of Use]]).
test case
>>> site = pywikibot.Site('en', 'wikipedia') >>> wmf_page = pywikibot.Page(site, 'wmf:Terms of Use') >>> wmf_page.title() Traceback (most recent call last): File "/shared/pywikipedia/core/pywikibot/page.py", line 6098, in parse newsite = self._site.interwiki(prefix) File "/shared/pywikipedia/core/pywikibot/site.py", line 963, in interwiki return self._interwikimap[prefix].site File "/shared/pywikipedia/core/pywikibot/site.py", line 709, in __getitem__ raise self._iw_sites[prefix].site File "/shared/pywikipedia/core/pywikibot/site.py", line 659, in site self._site = pywikibot.Site(url=self.url) File "/shared/pywikipedia/core/pywikibot/__init__.py", line 1229, in Site code, fam = _code_fam_from_url(url) File "/shared/pywikipedia/core/pywikibot/__init__.py", line 1186, in _code_fam_from_url raise SiteDefinitionError("Unknown URL '{0}'.".format(url)) pywikibot.exceptions.SiteDefinitionError: Unknown URL 'https://foundation.wikimedia.org/wiki/$1'. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<console>", line 1, in <module> File "/shared/pywikipedia/core/pywikibot/tools/__init__.py", line 1744, in wrapper return obj(*__args, **__kw) File "/shared/pywikipedia/core/pywikibot/page.py", line 328, in title title = self._link.canonical_title() File "/shared/pywikipedia/core/pywikibot/page.py", line 5809, in canonical_title if self.namespace != Namespace.MAIN: File "/shared/pywikipedia/core/pywikibot/page.py", line 6205, in namespace self.parse() File "/shared/pywikipedia/core/pywikibot/page.py", line 6105, in parse .format(self._text, self._site, prefix, e)) pywikibot.exceptions.SiteDefinitionError: wmf:Terms of Use is not a local page on wikipedia:en, and the interwiki prefix wmf is not supported by Pywikibot! Unknown URL 'https://foundation.wikimedia.org/wiki/$1'.
version
Pywikibot: [https] r-pywikibot-core.git (6d8ee14, g1, 2019/11/07, 16:25:26, ok)
Release version: 3.1.dev0
requests version: 2.12.4
cacerts: /etc/ssl/certs/ca-certificates.crt
certificate test: ok
Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516]
Toolforge hostname: tools-sgebastion-08