示例#1
0
    def execute(self, key, fops, force=None):
        """执行持久化处理:

        Args:
            key:    待处理的源文件
            fops:   处理详细操作,规格详见 http://developer.qiniu.com/docs/v6/api/reference/fop/
            force:  强制执行持久化处理开关

        Returns:
            一个dict变量,返回持久化处理的persistentId,类似{"persistentId": 5476bedf7823de4068253bae};
            一个ReponseInfo对象
        """
        ops = ';'.join(fops)
        data = {'bucket': self.bucket, 'key': key, 'fops': ops}
        if self.pipeline:
            data['pipeline'] = self.pipeline
        if self.notify_url:
            data['notifyURL'] = self.notify_url
        if force == 1:
            data['force'] = 1

        url = 'http://{0}/pfop'.format(config.get_default('default_api_host'))
        return http._post_with_auth(url, data, self.auth)
示例#2
0
 def __post(self, url, data=None, callback=None):
     http._post_with_auth(url, data, self.auth, callback=callback)