Skip to content

Instantly share code, notes, and snippets.

@PierreSelim
Created August 24, 2016 11:58
Show Gist options
  • Save PierreSelim/7c638438c4d5a3299a8106a3aa3dbc31 to your computer and use it in GitHub Desktop.
Save PierreSelim/7c638438c4d5a3299a8106a3aa3dbc31 to your computer and use it in GitHub Desktop.
Pywikibot claim
# -*- coding: utf-8  -*-
import pywikibot
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
# Q42 has P19 Q350
item = pywikibot.ItemPage(repo, u"Q42")
claim = pywikibot.Claim(repo, u'P19')
target = pywikibot.ItemPage(repo, u"Q350")
claim.setTarget(target)
item.addClaim(claim)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment