There isn't a way to instantiate `Page` from an id. You need a title. What you are attempting with page_from_repository is for sites with a Wikibase repository and uses the Wikibase QID, not the page id from the database.
The closest is site.load_pages_from_pageids https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.site.html#pywikibot.site._generators.GeneratorsMixin.load_pages_from_pageids, which creates a generator yielding `Page`s by querying for the titles. pagegenerators.PagesFromPageidGenerator https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.pagegenerators.html#pagegenerators.PagesFromPageidGenerator wraps around that for use on the CLI (-pageid). I usually have some variation of the below when using pywikibot's page generators on the CLI.
local_args = pywikibot.handle_args() site = pywikibot.Site() gen_factory = pywikibot.pagegenerators.GeneratorFactory(site) script_args = gen_factory.handle_args(local_args) gen = gen_factory.getCombinedGenerator(preload=True)
If you're querying your DB, you may find pagegenerators.MySQLPageGenerator https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.pagegenerators.html#pagegenerators.MySQLPageGenerator (-mysqlquery) useful.
Regards, JJ
On Thu, May 11, 2023 at 3:13 PM mlois_-gr@lezinter.net wrote:
It seems problem2 was just about adding
def isPublic(self): return False
in my family file : https://www.mediawiki.org/wiki/Manual:Pywikibot/Use_on_third-party_wikis#Bot... Sorry I hadn't found that earlier.
Problem 1 remains :
I'm trying to instantiate a `Page` based on its id, but I can't seem to
find
something that does… The closest to it seems to be "page_from_repository(pageId)", but I get
"pywikibot.exceptions.UnknownExtensionError: Wikibase is not implemented for [mywikifamily:fr]."
From there on, I don't know what to do.
pywikibot mailing list -- pywikibot@lists.wikimedia.org Public archives at https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/me... To unsubscribe send an email to pywikibot-leave@lists.wikimedia.org