def authorized(self, auth_code, redirect_uri, client_id, deploy_id=''): return self.filter( consumed=False, expires__gt=utcnow(), auth_code=auth_code, redirect_uri=redirect_uri, grant__client_id=client_id, deploy_id=deploy_id, )
def auth_code_expires(): now = utcnow() delta = timedelta(seconds=AUTH_CODE_EXPIRE_SECONDS) return now + delta