Hi, pywikibot experts:
I am now creating new Property using the wikidata Wbeditentity API
<https://www.wikidata.org/w/api.php?action=help&modules=wbeditentity>, I'm
running wikibase software via the wikibase-Docker images on my local
machine, and use the pywikibot() script:
data = {
'datatype': 'math', # mandatory
'descriptions': {
'en': {
'language': 'en',
'value': row['Property Description']
}
},
'labels': {
'en': {
'language': 'en',
'value': row['Property Label']
}
}
}
params = {
'action': 'wbeditentity',
'new': 'property',
'data': json.dumps(data),
'summary': 'bot adding in properties',
'token': site.tokens['edit']
}
req = site._simple_request(**params)
results = req.submit()
It would report errors when creating the following datatypes:
*math wikibase-sense wikibase-lexeme musical-notation wikibase-form *
ERROR: P5973 param-illegal: A datatype was expected, but either missing or
not recognized. [messages:[{'name': 'wikibase-api-not-recognized-datatype',
'parameters': [], 'html': {'*': 'A datatype was expected, but either
missing or not recognized.'}}]; help:See http://localhost:8181/w/api.php
for API usage.
The other types will return success, just list some:
external-id
wikibase-item
...
geo-shape
However, the unsupported datatypes are in the supported datatype list by
the official document: https://www.wikidata.org/wiki/Help:Data_type
Any idea?
--
Regards,
Mosha
Hi, pywikibot experts,
I've read through this ticket(
https://www.mail-archive.com/pywikibot@lists.wikimedia.org/msg00186.html)
for creating a new property using site._simple_request(**argv) api call, I
wonder how I can delete a property using a similar way?
for example code like this way:
params = {
'action': 'delete',
'id': 'P10',
'summary': 'bot remove',
'token': site.tokens['delete']
}
req = site._simple_request(**params)
results = req.submit()
print (results)
I've searched the actions by wikimedia API:
https://www.wikidata.org/w/api.php?action=help, It seems there's no action
for delete property, any idea?
--
Regards,
Mosha
Hello,
I want to run pywikibot script from inside docker, and I don't want to
interactively go into it and login using keyboard. What should I do to
login?
I asked similar question on stack overflow
<https://stackoverflow.com/questions/59254302/how-to-login-with-pywikibot-us…>,
but got no answer there.
Thank you for any suggestions.
Sincerely,
Taras Bunyk
Hi,
I have a little problem using pywikibot with wikidata…… I’m setting a unit like:
wikibase_unit = pywikibot.ItemPage(wikibase_repo, id)
target = pywikibot.WbQuantity(amount=wikidata_amount, unit=wikibase_unit, site=wikibase_repo, error = Decimal(wikidata_upperBound) - Decimal(wikidata_amount))
The problem is the URL of wikibase_unit. It is http://localhost:8181 <http://localhost:8181/> instead of the public URL. The public URL is specified when I create the wikibase_repo in the family file.
Any clue? Can someone help?
Merci
D063520