本文整理汇总了Python中sinastorage.bucket.SCSBucket.send方法的典型用法代码示例。如果您正苦于以下问题:Python SCSBucket.send方法的具体用法?Python SCSBucket.send怎么用?Python SCSBucket.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sinastorage.bucket.SCSBucket
的用法示例。
在下文中一共展示了SCSBucket.send方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import send [as 别名]
def run(self):
try:
self.mutex.lock()
self.state = RunnableState.RUNNING
s = SCSBucket(self.bucketName)
if self.key.rfind('/') == len(self.key)-1 :
m = (("prefix", smart_str(self.key)),
("delimiter", '/'),
("max-keys", 5),
("formatter","json"))
args = dict((str(k), str(v)) for (k, v) in m if v is not None)
response = s.send(s.request(key='', args=args))
files_generator = SCSListing.parse(response)
if files_generator.contents_quantity > 0 or files_generator.common_prefixes_quantity > 0 :
for item in files_generator:
if cmp(item[0],self.key) != 0:
self.emitter.emit(QtCore.SIGNAL("DeleteObjectForbidden(PyQt_PyObject,PyQt_PyObject)"), self, u'不能删除非空目录(前缀) ')
return
# s = SCSBucket(self.bucketName)
self.response = s.send(s.request(method="DELETE", key=self.key))
except SCSError, e:
self.state = RunnableState.DID_FAILED
self.response = SCSResponse(e.urllib2Request, e.urllib2Response)
self.response._responseBody = e.data
self.emitter.emit(QtCore.SIGNAL("DeleteObjectDidFailed(PyQt_PyObject,PyQt_PyObject)"), self, e.msg)
return