Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:wikibaseintegrator [2025/02/10 03:42] darrontools:wikibaseintegrator [2025/02/11 07:30] (current) darron
Line 1: Line 1:
 ====WikibaseIntegrator==== ====WikibaseIntegrator====
  
-[[https://github.com/LeMyst/WikibaseIntegrator|WikibaseIntegrator]] is a python package designed to interact with Wikibase. It's a fork of [[https://github.com/SuLab/WikidataIntegrator|WikidataIntegrator]].+[[https://github.com/LeMyst/WikibaseIntegrator|WikibaseIntegrator]] is a python package written to interact with Wikibase and Jupyter notebooks. It's a fork of [[https://github.com/SuLab/WikidataIntegrator|WikidataIntegrator]].
  
 ===Clone=== ===Clone===
Line 7: Line 7:
 <code> <code>
 git clone --recursive https://github.com/LeMyst/WikibaseIntegrator git clone --recursive https://github.com/LeMyst/WikibaseIntegrator
-</code> 
- 
-Perform operations inside the repository directory. 
- 
-<code> 
 cd WikibaseIntegrator cd WikibaseIntegrator
 </code> </code>
Line 24: Line 19:
  
 ===Test=== ===Test===
 +
 +<code>
 +source ~/.venvs/wikibaseintegrator/bin/activate.csh
 +</code>
  
 <code> <code>
Line 30: Line 29:
  
 <code> <code>
 +#! /usr/bin/env python
 +
 from wikibaseintegrator import WikibaseIntegrator from wikibaseintegrator import WikibaseIntegrator
 +from wikibaseintegrator.wbi_config import config as wbi_config
 +
 +wbi_config['USER_AGENT'] = 'Bot/0.1 (nobody@example.com)'
  
 wbi = WikibaseIntegrator() wbi = WikibaseIntegrator()
 my_first_wikidata_item = wbi.item.get(entity_id='Q5') my_first_wikidata_item = wbi.item.get(entity_id='Q5')
  
-# to check successful installation and retrieval of the data, you can print the json representation of the item 
 print(my_first_wikidata_item.get_json()) print(my_first_wikidata_item.get_json())
 </code> </code>
  
 <code> <code>
-~/.venvs/wikibaseintegrator/bin/python human.py+chmod +x human.py 
 +./human.py
 </code> </code>
  
 <code> <code>
-WARNING: Please set an user agent if you interact with a Wikibase instance from the Wikimedia Foundation. +deactivate
-More information in the README.md and https://foundation.wikimedia.org/wiki/Policy:User-Agent_policy +
-...+
 </code> </code>
 +
 +===Resources===
 +
 +[[https://jupyterlab.readthedocs.io/en/latest/|JupyterLab]]
 +
 +[[https://www.geeksforgeeks.org/python-web-scraping-tutorial/|Web scraping]]