Skip to content

Commit

Permalink
Add props parameter to wbgetentities
Browse files Browse the repository at this point in the history
  • Loading branch information
LeMyst committed Feb 14, 2022
1 parent 0d281b5 commit ef59bfb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions wikibaseintegrator/entities/baseentity.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def from_json(self, json_data: Dict[str, Any]) -> BaseEntity:

return self

# noinspection PyMethodMayBeStatic
def _get(self, entity_id: str, login: _Login = None, allow_anonymous: bool = True, is_bot: bool = None, **kwargs: Any) -> Dict: # pylint: disable=no-self-use
def _get(self, entity_id: str, login: _Login = None, allow_anonymous: bool = True, is_bot: bool = None, props: List = None, **kwargs: Any) -> Dict:
"""
Retrieve an entity in json representation from the Wikibase instance
Expand All @@ -98,6 +97,9 @@ def _get(self, entity_id: str, login: _Login = None, allow_anonymous: bool = Tru
'format': 'json'
}

if props:
params.update({'props': '|'.join(props)})

login = login or self.api.login
is_bot = is_bot if is_bot is not None else self.api.is_bot

Expand Down
2 changes: 1 addition & 1 deletion wikibaseintegrator/wbi_fastrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ def _process_lang(result: List) -> defaultdict[str, set]:
def get_prop_datatype(self, prop_nr: str) -> Optional[str]: # pylint: disable=no-self-use
from wikibaseintegrator import WikibaseIntegrator
wbi = WikibaseIntegrator()
property = wbi.property.get(prop_nr)
property = wbi.property.get(prop_nr, props=['datatype'])
return property.datatype

def clear(self) -> None:
Expand Down

0 comments on commit ef59bfb

Please sign in to comment.