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