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:
  • entities (str | list[str]) – A list of IDs. Item, Property, Lexeme or MediaInfo.

  • allow_anonymous (bool, default: True) – Allow an anonymous request to the MediaWiki API. Enabled by default.

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: