本文整理汇总了Python中sinastorage.bucket.SCSBucket.putFileByHeaders方法的典型用法代码示例。如果您正苦于以下问题:Python SCSBucket.putFileByHeaders方法的具体用法?Python SCSBucket.putFileByHeaders怎么用?Python SCSBucket.putFileByHeaders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sinastorage.bucket.SCSBucket
的用法示例。
在下文中一共展示了SCSBucket.putFileByHeaders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upload
# 需要导入模块: from sinastorage.bucket import SCSBucket [as 别名]
# 或者: from sinastorage.bucket.SCSBucket import putFileByHeaders [as 别名]
def upload(self):
''' 普通上传 '''
try:
self.mutex.lock()
self.state = RunnableState.RUNNING
s = SCSBucket(self.bucketName)
self.fileWithCallback = FileWithCallback(self.filePath, 'rb', self.uploadCallBack)
scsResponse = s.putFileByHeaders('%s%s'%(self.prefix,os.path.basename(self.filePath)), self.fileWithCallback)
self.response = scsResponse
except SCSError, e:
self.response = SCSResponse(e.urllib2Request, e.urllib2Response)
if isinstance(e, ManualCancel): #手动取消
self.state = RunnableState.DID_CANCELED
self.response._responseBody = u'手动取消'
self.emitter.emit(QtCore.SIGNAL("fileUploadDidCanceled(PyQt_PyObject,PyQt_PyObject)"), self, e.msg)
else:
self.state = RunnableState.DID_FAILED
self.response._responseBody = e.data
self.emitter.emit(QtCore.SIGNAL("fileUploadDidFailed(PyQt_PyObject,PyQt_PyObject)"), self, e.msg)
return