本文整理汇总了Python中googleapiclient.http.MediaIoBaseUpload.resumable方法的典型用法代码示例。如果您正苦于以下问题:Python MediaIoBaseUpload.resumable方法的具体用法?Python MediaIoBaseUpload.resumable怎么用?Python MediaIoBaseUpload.resumable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类googleapiclient.http.MediaIoBaseUpload
的用法示例。
在下文中一共展示了MediaIoBaseUpload.resumable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_media_io_base_upload_from_file_io
# 需要导入模块: from googleapiclient.http import MediaIoBaseUpload [as 别名]
# 或者: from googleapiclient.http.MediaIoBaseUpload import resumable [as 别名]
def test_media_io_base_upload_from_file_io(self):
fd = FileIO(datafile('small.png'), 'r')
upload = MediaIoBaseUpload(
fd=fd, mimetype='image/png', chunksize=500, resumable=True)
self.assertEqual('image/png', upload.mimetype())
self.assertEqual(190, upload.size())
self.assertEqual(True, upload.resumable())
self.assertEqual(500, upload.chunksize())
self.assertEqual(b'PNG', upload.getbytes(1, 3))
示例2: test_media_io_base_upload_from_string_io
# 需要导入模块: from googleapiclient.http import MediaIoBaseUpload [as 别名]
# 或者: from googleapiclient.http.MediaIoBaseUpload import resumable [as 别名]
def test_media_io_base_upload_from_string_io(self):
f = open(datafile('small.png'), 'r')
fd = StringIO.StringIO(f.read())
f.close()
upload = MediaIoBaseUpload(
fd=fd, mimetype='image/png', chunksize=500, resumable=True)
self.assertEqual('image/png', upload.mimetype())
self.assertEqual(190, upload.size())
self.assertEqual(True, upload.resumable())
self.assertEqual(500, upload.chunksize())
self.assertEqual('PNG', upload.getbytes(1, 3))
f.close()
示例3: test_media_io_base_upload_from_bytes
# 需要导入模块: from googleapiclient.http import MediaIoBaseUpload [as 别名]
# 或者: from googleapiclient.http.MediaIoBaseUpload import resumable [as 别名]
def test_media_io_base_upload_from_bytes(self):
try:
import io
f = open(datafile('small.png'), 'r')
fd = io.BytesIO(f.read())
upload = MediaIoBaseUpload(
fd=fd, mimetype='image/png', chunksize=500, resumable=True)
self.assertEqual('image/png', upload.mimetype())
self.assertEqual(190, upload.size())
self.assertEqual(True, upload.resumable())
self.assertEqual(500, upload.chunksize())
self.assertEqual('PNG', upload.getbytes(1, 3))
except ImportError:
pass