

def get(self, client_id_str=''):
    'AppleSUS get handler.\n\n    Args:\n      name: str, optional, catalog name to get.\n    '
    session = auth.DoAnyAuth()
    client_id = handlers.GetClientIdForRequest(self.request, session=session, client_id_str=client_id_str)
    full_os_version = (client_id.get('os_version', '') or '')
    os_version = '.'.join(full_os_version.split('.', 2)[:2])
    track = client_id.get('track', 'stable')
    catalog_name = ('%s_%s' % (os_version, track))
    catalog = models.AppleSUSCatalog.MemcacheWrappedGet(catalog_name)
    if (not catalog):
        logging.warning('Apple SUS catalog not found: %s', catalog_name)
        self.response.set_status(404)
        return
    header_date_str = self.request.headers.get('If-Modified-Since', '')
    catalog_date = catalog.mtime
    if handlers.IsClientResourceExpired(catalog_date, header_date_str):
        self.response.headers['Last-Modified'] = catalog_date.strftime(handlers.HEADER_DATE_FORMAT)
        self.response.headers['Content-Type'] = 'text/xml; charset=utf-8'
        self.response.out.write(catalog.plist)
    else:
        self.response.set_status(304)

dataset/ETHPy150Open google/simian/src/simian/mac/munki/handlers/applesus.py AppleSUS.get/original