samuelmeuli / wikibase-api

📦 Wrapper library for the Wikibase API
https://wikibase-api.readthedocs.io
Other
4 stars 3 forks source link

Claim object has no attribute 'get' #2

Open pebbie opened 4 years ago

pebbie commented 4 years ago

It seems not yet implemented although it is used as example in the documentation. This code below should fix it

    def get(self, entity_id, property_id=None, rank=None):
        """Get claims for the specified entity

        :param entity_id: Entity identifier (e.g. ``"Q1"``)
        :type entity_id: str
        :param property_id: Property identifier (e.g. ``"P1"``)
        :type property_id: str
        :param rank: Optional filter to return only the claims that have the specified rank
            (one of ``["deprecated", "normal", "preferred"]``)
        :type rank: str
        :return: Response
        :rtype: dict
        """
        params = {
            "action": "wbgetclaims",
            "entity": entity_id,
        }
        if property_id is not None: params['property'] = property_id
        if rank is not None: params['rank'] = rank
        return self.api.get(params)
cknoll commented 2 years ago

I also was confused by the documentation, which references nonexisting .get method, see:

https://wikibase-api.readthedocs.io/en/latest/api_reference/models/claim.html