当前位置: 首页>>代码示例>>Python>>正文


Python MediaIoBaseUpload.resumable方法代码示例

本文整理汇总了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))
开发者ID:nghgminhtri,项目名称:google-api-python-client,代码行数:11,代码来源:test_http.py

示例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()
开发者ID:Acidburn0zzz,项目名称:google-api-python-client,代码行数:15,代码来源:test_http.py

示例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
开发者ID:Acidburn0zzz,项目名称:google-api-python-client,代码行数:17,代码来源:test_http.py


注:本文中的googleapiclient.http.MediaIoBaseUpload.resumable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。