def check_token(self, token):

        if not hasattr(token, 'timestamp'):
            raise AttributeError('token doesn\'t have a timestamp attribute')

        if (int(token.timestamp) + 3600) < time.time():
            token = self.refresh_token(token)

        return token
Check to see if a token has expired
dataset/ETHPy150Open project-fondue/python-yql/yql/__init__.py/ThreeLegged.check_token