Do an HTTPS Upload of the archive

def upload_archive(self, data_collected, content_type, duration):
        """
        Do an HTTPS Upload of the archive
        """
        if self.config.legacy_upload:
            return self._legacy_upload_archive(data_collected, duration)
        file_name = os.path.basename(data_collected)
        upload_url = self.upload_url
        c_facts = {}

        try:
            c_facts = get_canonical_facts()
        except Exception as e:
            logger.debug('Error getting canonical facts: %s', e)
        if self.config.display_name:
            # add display_name to canonical facts
            c_facts['display_name'] = self.config.display_name
        c_facts = json.dumps(c_facts)
        logger.debug('Canonical facts collected:\n%s', c_facts)

        files = {
            'file': (file_name, open(data_collected, 'rb'), content_type),
            'metadata': c_facts
        }
        logger.debug("Uploading %s to %s", data_collected, upload_url)

        net_logger.info("POST %s", upload_url)
        upload = self.session.post(upload_url, files=files, headers={})

        logger.debug("Upload status: %s %s %s",
                     upload.status_code, upload.reason, upload.text)
        logger.debug('Request ID: %s', upload.headers.get('x-rh-insights-request-id', None))
        if upload.status_code == 202:
            # 202 from platform, no json response
            logger.debug(upload.text)
            # upload = registration on platform
            write_registered_file()
        else:
            logger.error(
                "Upload archive failed with status code  %s",
                upload.status_code)
            return upload
        logger.debug("Upload duration: %s", upload.elapsed)
        return upload