Example #1
0
    def __init__(self):
        conf_file = os.path.expanduser("~/.boxrc" if is_posix() else "~/_boxrc")
        if not os.path.exists(conf_file):
            raise ConfigError("Configuration file {} not found".format(conf_file))

        try:
            conf_parser = ConfigParser.ConfigParser()
            conf_parser.read(conf_file)
            self._conf_parser = conf_parser
            self._api_key = conf_parser.get("app", "api_key")
        except ConfigParser.NoSectionError as e:
            raise ConfigError("{} (in configuration file {})".format(e, conf_file))

        self._ticket = None
        self._auth_token = None
Example #2
0
    def __init__(self):
        conf_file = os.path.expanduser(
                "~/.boxrc" if is_posix() else "~/_boxrc")
        if not os.path.exists(conf_file):
            raise ConfigError(
                    "Configuration file {} not found".format(conf_file))

        try:
            conf_parser = ConfigParser.ConfigParser()
            conf_parser.read(conf_file)
            self._conf_parser = conf_parser
            self._api_key = conf_parser.get("app", "api_key")
        except ConfigParser.NoSectionError as e:
            raise ConfigError("{} (in configuration file {})"
                    .format(e, conf_file))

        self._ticket = None
        self._auth_token = None
Example #3
0
    def __init__(self):
        conf_file = os.path.expanduser(
            "~/.boxrc" if is_posix() else "~/_boxrc")
        if not os.path.exists(conf_file):
            raise ConfigError(
                "Configuration file {} not found".format(conf_file))

        try:
            conf_parser = ConfigParser.ConfigParser()
            conf_parser.read(conf_file)
            self._conf_file = conf_file
            self._conf_parser = conf_parser
            self._client_id = conf_parser.get("app", "client_id")
            self._client_secret = conf_parser.get("app", "client_secret")
        except ConfigParser.NoSectionError as e:
            raise ConfigError("{} (in configuration file {})".format(
                e, conf_file))

        self._access_token = None
        self._refresh_token = None
        self._token_time = None