The following is a small sample just for reading a wikidata entry:

trunk version:
import wikipedia as wp
s = wp.getSite('wikidata', 'wikidata')
p = wp.Page(s, 'Q321')
data = eval(p.get()) # evaluation is needed for transform text into dictionary

data is a data dictionary. Try
data.keys()
for the data keys which are

['statements', 'description', 'links', 'entity', 'label', 'aliases']

rewrite branch:
# The family file was introduced one month ago and has different language 
codes. 'repro' is for the repository.
import pwb
import pywikibot as wp
s = wp.getSite('repro', 'wikidata')
p = wp.Page(s, 'Q321')
data = eval(p.get())
data.keys()

have fun with playing with that information
xqt

----- Original Nachricht ----
Von:     Amir Ladsgroup <[email protected]>
An:      Pywikipedia discussion list <[email protected]>
Datum:   20.10.2012 07:18
Betreff: [Pywikipedia-l] Wikidata

> Hi everyone
> I added wikidata edits on PWB. for now it's basic and you can only change
> or add or remove labels but i have plan to imporve it.
> 
> You can add wikidata family to your user-config.py and run a simillar code:
> 
> import wikipedia
> site=wikipedia.getSite('wikidata',fam='wikidata')
> page=wikipedia.Page(site,"Q321")
> page.put(u"",u"Bot:
> testing",wikidata=True,labelwikidata=u"no",valuewikidata=u"Test FOO")
> 
> I ran that and it
> worked<http://wikidata-test-repo.wikimedia.de/w/index.php?title=Q321&curid=9
> 133&diff=105698&oldid=105697>but
> if there is any bugs feel free to tell me
> 
> Cheers
> -- 
> Amir
> 
> 
> --------------------------------
> 
> _______________________________________________
> Pywikipedia-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
> 

_______________________________________________
Pywikipedia-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l

Reply via email to