generate_entity_instances#
- wikibaseintegrator.wbi_helpers.generate_entity_instances(entities, allow_anonymous=True, **kwargs)[source]#
A method which allows for retrieval of a list of Wikidata entities. The method generates a list of tuples where the first value in the tuple is the entity’s ID, whereas the second is the new instance of a subclass of BaseEntity containing all the data of the entity. This is most useful for mass retrieval of entities. The entities are requested by batches of 50, the limit of wbgetentities.
- Parameters:
- Return type:
list[tuple[str,BaseEntity]]- Returns:
A list of tuples, first value in the tuple is the entity’s ID, second value is the instance of a subclass of BaseEntity with the corresponding entity data.
- Raises:
NonExistentEntityError – If an ID doesn’t exist on the Wikibase instance
MissingEntityException – If an entity is missing, e.g. deleted
ValueError – If an entity has a type that no subclass of BaseEntity implements