I changed again and the code runs if you run it this way:
import wikipedia
site=wikipedia.getSite('wikidata',fam='wikidata')
page=wikipedia.Page(site,"Helium")
page.put(u"",u"BOT: TESTING FOO",wikidata={'type':u'item', 'label':'fa',
'value':'OK'})
page.put(u"",u"BOT: TESTING GOO",wikidata={'type':u'description',
'language':'en', 'value':'OK'})

You just need title now and you can change labels or description I'm
working on changing sitelinks

I must thank John Blad, He helped me very kindly

On Sat, Oct 20, 2012 at 3:19 PM, <i...@gno.de> wrote:

> 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 <ladsgr...@gmail.com>
> An:      Pywikipedia discussion list <pywikipedia-l@lists.wikimedia.org>
> 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
> > Pywikipedia-l@lists.wikimedia.org
> > https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
> >
>
> _______________________________________________
> Pywikipedia-l mailing list
> Pywikipedia-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
>



-- 
Amir
_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l

Reply via email to