(self)
Retrieve API usage limit and count
Retrieve API usage limit and count
Retrieve API usage limit and count
def usage(self):
        """
        Retrieve API usage limit and count
        """
        sign = hmac.new(
            self.key.encode("utf-8"),
            b'usage',
            hashlib.sha256
        ).hexdigest()
        res = self._query("/usage/id=%s&sign=%s" % (self.user, sign))
        if res.status_code != 200:
            raise TotalHashError()
        else:
            return res.text
def usage ( self ) : sign = hmac . new ( self . key . encode ( "utf-8" ) , b'usage' , hashlib . sha256 ) . hexdigest ( ) res = self . _query ( "/usage/id=%s&sign=%s" % ( self . user , sign ) ) if res . status_code != 200 : raise TotalHashError ( ) else : return res . text