How to use the maestral.config.main.CONF.set function in maestral

To help you get started, we’ve selected a few maestral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SamSchott / maestral-dropbox / maestral / sync / main.py View on Github external
def set_conf(section, name, value):
        CONF.set(section, name, value)
github SamSchott / maestral-dropbox / maestral / client.py View on Github external
try:
            res = self.dbx.users_get_space_usage()
        except dropbox.exceptions.ApiError as err:
            logging.debug("Failed to get space usage: %s", err)
            return False

        # convert from dropbox.users.SpaceUsage to SpaceUsage with nice string
        # representation
        res.__class__ = SpaceUsage

        if res.allocation.is_team():
            CONF.set("account", "usage_type", "team")
        elif res.allocation.is_individual():
            CONF.set("account", "usage_type", "individual")

        CONF.set("account", "usage", str(res))

        return res
github SamSchott / maestral-dropbox / maestral / sync / client.py View on Github external
except dropbox.exceptions.DropboxException as exc:
            raise to_maestral_error(exc)

        if res.account_type.is_basic():
            account_type = 'basic'
        elif res.account_type.is_business():
            account_type = 'business'
        elif res.account_type.is_pro():
            account_type = 'pro'
        else:
            account_type = ''

        CONF.set("account", "account_id", res.account_id)
        CONF.set("account", "email", res.email)
        CONF.set("account", "display_name", res.name.display_name)
        CONF.set("account", "abbreviated_name", res.name.abbreviated_name)
        CONF.set("account", "type", account_type)

        return res
github SamSchott / maestral-dropbox / maestral / sync / client.py View on Github external
res = self.dbx.users_get_current_account()

        if not dbid:
            # save our own account info to config
            if res.account_type.is_basic():
                account_type = "basic"
            elif res.account_type.is_business():
                account_type = "business"
            elif res.account_type.is_pro():
                account_type = "pro"
            else:
                account_type = ""

            CONF.set("account", "account_id", res.account_id)
            CONF.set("account", "email", res.email)
            CONF.set("account", "display_name", res.name.display_name)
            CONF.set("account", "abbreviated_name", res.name.abbreviated_name)
            CONF.set("account", "type", account_type)

        return res
github SamSchott / maestral-dropbox / maestral / cli.py View on Github external
def config_add(name: str):
    """Set up and activate a fresh Maestral configuration."""
    if name in list_configs():
        click.echo("Configuration '{}' already exists.".format(name))
    else:
        from maestral.config.main import load_config
        load_config(name)
        from maestral.config.main import CONF
        CONF.set("main", "default_dir_name", "Dropbox ({})".format(name.capitalize()))
        click.echo("Created configuration '{}'.".format(name))
github SamSchott / maestral-dropbox / maestral / sync / main.py View on Github external
def _periodic_refresh(self):
        while True:
            # update account info
            self.get_account_info()
            self.get_space_usage()
            self.get_profile_pic()
            # check for maestral updates
            res = self.check_for_updates()
            if not res["error"]:
                CONF.set("app", "latest_release", res["latest_release"])
            time.sleep(60*60)  # 60 min
github SamSchott / maestral-dropbox / maestral / sync / client.py View on Github external
raise to_maestral_error(exc)

        if res.account_type.is_basic():
            account_type = 'basic'
        elif res.account_type.is_business():
            account_type = 'business'
        elif res.account_type.is_pro():
            account_type = 'pro'
        else:
            account_type = ''

        CONF.set("account", "account_id", res.account_id)
        CONF.set("account", "email", res.email)
        CONF.set("account", "display_name", res.name.display_name)
        CONF.set("account", "abbreviated_name", res.name.abbreviated_name)
        CONF.set("account", "type", account_type)

        return res
github SamSchott / maestral-dropbox / maestral / client.py View on Github external
# apply created files
        with ThreadPoolExecutor(max_workers=10) as executor:
            success = executor.map(self._create_local_entry, all_files)
        if all(success) is False:
            return False

        # apply deleted items
        with ThreadPoolExecutor(max_workers=10) as executor:
            success = executor.map(self._create_local_entry, all_deleted)
        if all(success) is False:
            return False

        # save cursor
        if save_cursor:
            self.last_cursor = results[-1].cursor
            CONF.set("internal", "cursor", result.cursor)

        return True
github SamSchott / maestral-dropbox / maestral / sync / oauth.py View on Github external
def delete_creds(self):
        """Deletes auth key from system keyring."""
        CONF.set("account", "account_id", "")
        try:
            keyring.delete_password("Maestral", self.account_id)
            print(" > Credentials removed.")
        except KeyringLocked:
            logger.error("Could not access the user keyring to delete your authentication"
                         " token. Please make sure that the keyring is unlocked.")