Bugs item #3605408, was opened at 2013-02-20 03:39 Message generated for change (Comment added) made by reza1615 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3605408...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: update items in wikidata
Initial Comment: I want to add new lang to an item in wikidata I use this code it says page is updated but it doesn't change page!
dataSite=wikipedia.getSite('wikidata','wikidata') data = pywikibot.DataPage(dataSite, 'Q1234') lang='fa' fa_title='تست'
data.setitem(summary,items={'type': u'item', 'label': lang, 'value': fa_title}) data.setitem(summary,items={'type': u'sitelink', 'site': lang, 'title': fa_title})
----------------------------------------------------------------------
Comment By: reza (reza1615) Date: 2013-02-22 03:20
Message: I confused :) please write two simple examples which can 1-add a new item to wikidata 2-add a lang , title and lable to existing item
----------------------------------------------------------------------
Comment By: xqt (xqt) Date: 2013-02-22 02:20
Message: you first must call data.get() before changing a DataPage,otherwise the DataPage.title() is unknown
----------------------------------------------------------------------
Comment By: reza (reza1615) Date: 2013-02-21 09:14
Message: as you said I wrote the code
#!/usr/bin/python # -*- coding: utf-8 -*- import wikipedia lang='fa' fa_title=u'آبشار لاتون' summary=u'آبشار لاتون,آبشار لاتون'
site=wikipedia.getSite('fa',fam='wikipedia') page=wikipedia.Page(site,fa_title) data=wikipedia.DataPage(page) data.setitem(summary,items={'type': u'item', 'label': lang, 'value': fa_title}) data.setitem(summary,items={'type': u'sitelink', 'site': lang, 'title': fa_title})
it shows Sleeping for 19.6 seconds, 2013-02-21 17:10:27 Updating page [[wikidata:None]] via API Sleeping for 19.6 seconds, 2013-02-21 17:10:47 Updating page [[wikidata:None]] via API
it doesn't edit wikidata and add fa interwiki to Q5058182
----------------------------------------------------------------------
Comment By: Amir (amird) Date: 2013-02-21 08:46
Message: btw: there is difference between changing an entity and making a item. I'm working on making an item via API, but John Blad (API manager of wikidata) is in the vaction. I'll add this feature to the PWB ASAP
----------------------------------------------------------------------
Comment By: Amir (amird) Date: 2013-02-21 08:42
Message: i know the difference between wikipedia and wikidata,. when i say do it, trust me and do it, for god's sake. if didn't work tell me
----------------------------------------------------------------------
Comment By: reza (reza1615) Date: 2013-02-21 08:30
Message: this my code #!/usr/bin/python # -*- coding: utf-8 -*- import wikipedia dataSite=wikipedia.getSite('wikidata','wikidata') lang='fa' fa_title=u'قنات آب خنک، بیرجند' summary=u'قنات آب خنک، بیرجند, قنات آب خنک، بیرجند'
page=wikipedia.Page(dataSite,fa_title) data = wikipedia.DataPage(page)
data.setitem(summary,items={'type': u'item', 'label': lang, 'value': fa_title}) data.setitem(summary,items={'type': u'sitelink', 'site': lang, 'title': fa_title})
it shows me this message
Sleeping for 9.6 seconds, 2013-02-21 16:27:25 Updating page [[wikidata:قنات آب خنک، بیرجند]] via API Sleeping for 9.6 seconds, 2013-02-21 16:27:35 Updating page [[wikidata:قنات آب خنک، بیرجند]] via API
but it don't edit wikidata! and if you check this page you can not find it!
----------------------------------------------------------------------
Comment By: reza (reza1615) Date: 2013-02-21 08:13
Message: @amir if I why should I write site=wikipedia.getSite('fa',fam='wikipedia') I want to edit in wikidata not fa.wiki.
----------------------------------------------------------------------
Comment By: xqt (xqt) Date: 2013-02-20 23:49
Message: you may also use
data = wikipedia.DataPage(1234)
for creating the repository Page
or
site = wikipedia.getSite() data = wikipedia.DataPage(site.data_repository(), "Q1234")
----------------------------------------------------------------------
Comment By: Amir (amird) Date: 2013-02-20 04:03
Message: you must run it in this way: site=wikipedia.getSite('fa',fam='wikipedia') page=wikipedia.Page(site,'تست') data=wikipedia.DataPage(page) data.setitem(summary,items={'type': u'item', 'label': lang, 'value': fa_title}) data.setitem(summary,items={'type': u'sitelink', 'site': lang, 'title': fa_title})
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3605408...
pywikipedia-bugs@lists.wikimedia.org