コード例 #1
0
ファイル: __init__.py プロジェクト: JMSwag/PyUpdater
    def _get_update_manifest(self):
        log.debug('Loading version file...')

        data = self._get_manifest_from_http()
        if data is None:
            data = self._get_manifest_from_disk()

        if data is not None:
            try:
                log.debug('Data type: %s', type(data))
                # If json fails to load self.ready will stay false
                # which will cause _update_check to exit early
                self.json_data = json.loads(data.decode('utf-8'))

                # Ready to check for updates.
                self.ready = True
            except ValueError as err:
                # Malformed json???
                log.debug('Json failed to load: ValueError')
                log.debug(err, exc_info=True)
            except Exception as err:
                # Catch all for debugging purposes.
                # If seeing this line come up a lot in debug logs
                # please open an issue on github or submit a pull request
                log.debug(err, exc_info=True)
        else:
            log.debug('Failed to download version file & no '
                      'version file on filesystem')
            self.json_data = {}

        # If verified we set self.verified to True.
        self._verify_sig(self.json_data)

        self.easy_data = _EAD(self.json_data)
        log.debug('Version Data:\n%s', str(self.easy_data))
コード例 #2
0
    def _get_update_manifest(self):
        log.debug("Loading version file...")

        data = self._get_manifest_from_http()
        if data is None:
            data = self._get_manifest_from_disk()

        if data is not None:
            try:
                log.debug("Data type: %s", type(data))
                # If json fails to load self.ready will stay false
                # which will cause _update_check to exit early
                self.json_data = json.loads(data.decode("utf-8"))

                # Ready to check for updates.
                self.ready = True
            except ValueError as err:
                # Malformed json???
                log.debug("Json failed to load: ValueError")
                log.debug(err, exc_info=True)
            except Exception as err:
                # Catch all for debugging purposes.
                # If seeing this line come up a lot in debug logs
                # please open an issue on github or submit a pull request
                log.debug(err, exc_info=True)
        else:
            log.debug(
                "Failed to download version file & no " "version file on filesystem"
            )
            self.json_data = {}

        # If verified we set self.verified to True.
        self._verify_sig(self.json_data)

        self.easy_data = _EAD(self.json_data)
コード例 #3
0
ファイル: __init__.py プロジェクト: vvarp/PyUpdater
    def _get_update_manifest(self):
        #  Downloads & Verifies version file signature.
        log.debug('Loading version file...')

        data = self._download_manifest()
        if data is None:
            # Get the last downloaded manifest
            data = self._get_manifest_filesystem()

        if data is not None:
            try:
                log.debug('Data type: %s', type(data))
                # If json fails to load self.ready will stay false
                # which will cause _update_check to exit early
                self.json_data = json.loads(data.decode('utf-8'))

                # Ready to check for updates.
                self.ready = True
            except ValueError as err:
                # Malformed json???
                log.debug('Json failed to load: ValueError')
                log.debug(err, exc_info=True)
            except Exception as err:
                # Catch all for debugging purposes.
                # If seeing this line come up a lot in debug logs
                # please open an issue on github or submit a pull request
                log.debug(err, exc_info=True)
        else:
            log.debug('Failed to download version file & no '
                      'version file on filesystem')
            self.json_data = {}

        # If verified we set self.verified to True.
        self._verify_sig(self.json_data)

        self.easy_data = _EAD(self.json_data)
        log.debug('Version Data:\n%s', str(self.easy_data))