jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/633340 )
Change subject: [doc] Add a quick start wikibase sample to Readme.rst ......................................................................
[doc] Add a quick start wikibase sample to Readme.rst
Bug: T263938 Change-Id: I3b22979f9e9de83ac4f084d28d19511b6f8562ef --- M README.rst 1 file changed, 15 insertions(+), 0 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/README.rst b/README.rst index 564c72e..fc2e0b3 100644 --- a/README.rst +++ b/README.rst @@ -72,6 +72,21 @@ page.text = page.text.replace('foo', 'bar') page.save('Replacing "foo" with "bar"') # Saves the page
+Wikibase Usage +-------------- + +Wikibase is a flexible knowledge base software that drives Wikidata. +A sample pywikibot script for getting data from Wikibase: + +:: + + import pywikibot + site = pywikibot.Site('wikipedia:en') + repo = site.data_repository() # the wikibase repository for given site + page = repo.page_from_repository('Q91') # create a local page for the given item + item = pywikibot.ItemPage(repo, 'Q91') # a repository item + data = item.get() # get all item data from repository for this item + -------------------------------------------------------------------------------------------
For more documentation on pywikibot see our `docs https://doc.wikimedia.org/pywikibot/`_.