class BaseRequest(object): # bucket_name: bucket的名称 # cos_path: cos的绝对路径, 即从bucket下的根/开始 def __init__(self, bucket_name, cos_path): self._bucket_name = bucket_name.strip() self._cos_path = cos_path.strip() self._param_check = ParamCheck() # 设置bucket_name def set_bucket_name(self, bucket_name=u''): self._bucket_name = bucket_name.strip() # 获取bucket_name def get_bucket_name(self): return self._bucket_name # 设置cos_path def set_cos_path(self, cos_path=u''): self._cos_path = cos_path.strip() # 获取cos_path def get_cos_path(self): return self._cos_path # 获取错误信息 def get_err_tips(self): return self._param_check.get_err_tips() # 检查参数是否合法 def check_params_valid(self): if not self._param_check.check_param_unicode('bucket', self._bucket_name): return False return self._param_check.check_param_unicode('cos_path', self._cos_path)
class CredInfo(object): def __init__(self, appid, secret_id, secret_key): self._appid = appid self._secret_id = secret_id self._secret_key = secret_key self._param_check = ParamCheck() def get_appid(self): return self._appid def get_secret_id(self): return self._secret_id def get_secret_key(self): return self._secret_key def check_params_valid(self): if not self._param_check.check_param_int('appid', self._appid): return False if not self._param_check.check_param_unicode('secret_id', self._secret_id): return False return self._param_check.check_param_unicode('secret_key', self._secret_key) # 获取错误信息 def get_err_tips(self): return self._param_check.get_err_tips()
class CredInfo(object): """CredInfo用户的身份信息""" def __init__(self, appid, secret_id, secret_key): self._appid = appid self._secret_id = secret_id self._secret_key = secret_key self._param_check = ParamCheck() def get_appid(self): return self._appid def get_secret_id(self): return self._secret_id def get_secret_key(self): return self._secret_key def check_params_valid(self): if not self._param_check.check_param_int('appid', self._appid): return False if not self._param_check.check_param_unicode('secret_id', self._secret_id): return False return self._param_check.check_param_unicode('secret_key', self._secret_key) def get_err_tips(self): """获取错误信息 :return: """ return self._param_check.get_err_tips()
class BaseRequest(object): """BaseRequest基本类型的请求""" def __init__(self, bucket_name, cos_path): """ 类初始化 :param bucket_name: bucket的名称 :param cos_path: cos的绝对路径, 即从bucket下的根/开始 """ self._bucket_name = bucket_name.strip() self._cos_path = cos_path.strip() self._param_check = ParamCheck() def set_bucket_name(self, bucket_name=u''): """设置bucket_name :param bucket_name: :return: """ self._bucket_name = bucket_name.strip() def get_bucket_name(self): """获取bucket_name :return: """ return self._bucket_name def set_cos_path(self, cos_path=u''): """设置cos_path :param cos_path: :return: """ self._cos_path = cos_path.strip() def get_cos_path(self): """获取cos_path :return: """ return self._cos_path def get_err_tips(self): """获取错误信息 :return: """ return self._param_check.get_err_tips() def check_params_valid(self): """检查参数是否合法 :return: """ if not self._param_check.check_param_unicode('bucket', self._bucket_name): return False return self._param_check.check_param_unicode('cos_path', self._cos_path)
def __init__(self, bucket_name, cos_path): """ 类初始化 :param bucket_name: bucket的名称 :param cos_path: cos的绝对路径, 即从bucket下的根/开始 """ self._bucket_name = bucket_name.strip() self._cos_path = cos_path.strip() self._param_check = ParamCheck()
def __init__(self, appid, secret_id, secret_key): self._appid = appid self._secret_id = secret_id self._secret_key = secret_key self._param_check = ParamCheck()
def __init__(self, bucket_name, cos_path): self._bucket_name = bucket_name.strip() self._cos_path = cos_path.strip() self._param_check = ParamCheck()