Project:BotBased imports: Difference between revisions
From MaRDI portal
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
==== Create a bot that will do the changes ==== | ==== Create a bot that will do the changes ==== | ||
# Login to the | # Login to the mardi-wikibase docker container | ||
# Execute: php /var/www/html/w/maintenance/createAndPromote.php <BOTUSER_NAME> <BOTUSER_PW> --bot | # Execute: php /var/www/html/w/maintenance/createAndPromote.php <BOTUSER_NAME> <BOTUSER_PW> --bot | ||
Revision as of 10:15, 28 March 2025
Synopsis
If you want to use a script to import / update items in the MaRDI Knowledge Graph, you might want to to that by using a Python script and the MardiClient library. This document describes the main steps.
Create a bot that will do the changes
- Login to the mardi-wikibase docker container
- Execute: php /var/www/html/w/maintenance/createAndPromote.php <BOTUSER_NAME> <BOTUSER_PW> --bot
Create the Python script
The core is something like this:
from mardiclient import MardiClient
mc = MardiClient(user="username", password="my-password")
item = mc.item.new()
item.labels.set(language='en', value='My Label')
item.write()