In [8]:
from wikidataintegrator import wdi_core, wdi_login, wdi_helpers
from wikidataintegrator.wdi_core import WDItemEngine
In [9]:
# set urls
mediawiki_api_url = 'http://localhost:8181/w/api.php'
sparql_endpoint_url = 'http://localhost:8282/proxy/wdqs/bigdata/namespace/wdq/sparql'
In [10]:
# create a WDItemEngine class with the urls preset
LocalItemEngine = WDItemEngine.wikibase_item_engine_factory(mediawiki_api_url, sparql_endpoint_url)
In [13]:
# we can now retrieve this item from our local wikibase
litem = LocalItemEngine(wd_item_id="Q2")
litem.get_label()
Out[13]:
In [14]:
# and can also still access regular wikidata
item = WDItemEngine(wd_item_id="Q2")
item.get_label()
Out[14]:
In [17]:
# to login:
local_login = wdi_login.WDLogin("test", "password", mediawiki_api_url)