The current cache functionality is based on loading a json file, which is different for staging and production.
This is currently defined through the function _load_entity_mappings:
|
def _load_entity_mappings() -> dict: |
The problem is that this assumes that there is the WIKIBASE_HOST variable in the environment.
env = os.environ.get("WIKIBASE_HOST", "prod").lower()
This works from our containers defined in the staging and production environments but not if someone runs mardiclient locally and does not define a WIKIBASE_HOST variable.
In that case by default the mappings for production are loaded, even if the user might be connecting to the staging instance.
Possible fix
I suggest replacing the logic that uses WIKIBASE_HOST to distinguish between environments and use instead a variable that is already passed to create the MardiClient such as wikibase_url
|
wikibase_url = kwargs.pop("wikibase_url", config["WIKIBASE_URL"]) |
The current cache functionality is based on loading a json file, which is different for staging and production.
This is currently defined through the function _load_entity_mappings:
mardiclient/mardiclient/mardi_client.py
Line 90 in 5d82747
The problem is that this assumes that there is the WIKIBASE_HOST variable in the environment.
env = os.environ.get("WIKIBASE_HOST", "prod").lower()This works from our containers defined in the staging and production environments but not if someone runs mardiclient locally and does not define a WIKIBASE_HOST variable.
In that case by default the mappings for production are loaded, even if the user might be connecting to the staging instance.
Possible fix
I suggest replacing the logic that uses WIKIBASE_HOST to distinguish between environments and use instead a variable that is already passed to create the MardiClient such as wikibase_url
mardiclient/mardiclient/mardi_client.py
Line 70 in 5d82747